#ifndef UTILS_H #define UTILS_H // // Utilities // template struct IsSame { enum { r = false }; }; template struct IsSame { enum { r = true }; }; template struct Select { typedef B R; }; template struct Select { typedef A R; }; template struct Deref { typedef T R; }; template struct Deref { typedef T R; }; template struct Deref { typedef T R; }; template struct IsConst { enum { r = false }; }; template struct IsConst { enum { r = true }; }; template struct IsPtr { enum { r = false }; }; template struct IsPtr { enum { r = true }; }; template struct IsPtr { enum { r = true }; }; template struct IsPtr { enum { r = true }; }; template struct IsPtr { enum { r = true }; }; template struct IsAry { enum { r = false, bound = 0 /* note: must be 0 */ }; }; template struct IsAry { enum { r = true, bound = n }; }; //======================= template struct Deary { // note: other code assumes OK to Deary a non-array, multiple times typedef T R; }; template struct Deary { typedef T R; }; template struct DearyN { typedef typename DearyN::R,n-1>::R R; }; template struct DearyN { typedef T R; }; template struct AddAryN { typedef typename AddAryN::R R[1]; }; template struct AddAryN { typedef T R; }; //======================= template struct DePtrAry { // note: other code assumes OK to Deary a non-array, multiple times typedef T R; }; template struct DePtrAry { typedef T R; }; template struct DePtrAryN { typedef typename DePtrAryN::R,n-1>::R R; }; template struct DePtrAryN { typedef T R; }; template struct AddPtrAryN { typedef typename AddPtrAryN::R (*R)[1]; }; template struct AddPtrAryN { typedef T R; }; #endif