// // Copyright (c) 2002 by Stephen C. Dewhurst // Permission to use, copy, modify, distribute and sell this software for any purpose is // hereby granted without fee, provided that the above copyright notice appears in all copies // and that both that copyright notice and this permission notice appear in supporting documentation. // The author or makes no representations about the suitability of this software for any purpose. // It is provided "as is" without express or implied warranty. // // "typeof" operator implementation // // Described in CUJ 20(8, 10, and 12), August, October, and December 2002: "A Bit-Wise Typeof" // #ifndef TYPEOF2_H #define TYPEOF2_H #include "gengn.h" #include "gentype.h" // // Roundtrip: Use function template argument deduction to instantiate the Godel number for // the expression's type, then decode the Godel number to regenerate the type. // #define NT_TYPEOF( e ) GenType< \ sizeof(*genGN4(e))-1, \ sizeof(*genGN3(e))-1, \ sizeof(*genGN2(e))-1, \ sizeof(*genGN1(e))-1 \ >::GTR #define TYPEOF( e ) typename NT_TYPEOF(e) #endif