// Semantics Consulting's Tyr Library // http://www.semantics.org // // Copyright (c) 2003 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 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" // This version is a re-write of the original implementation that employs the typeint implementation // of extended precision compile time arithmetic. Typeints are described in CUJ online experts // column, February 2003. #ifndef TYPEOF_H #define TYPEOF_H #include "gengn.h" #include "gentype.h" namespace Tyr { // // 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< \ Or< \ LShift< \ Or< \ LShift< \ Or< \ LShift< \ TypeInt::R, \ nb \ >::R, \ TypeInt::R \ >::R, \ nb \ >::R, \ TypeInt::R \ >::R, \ nb \ >::R, \ TypeInt::R \ >::R \ >::GTR #define TYPEOF( e ) typename NT_TYPEOF(e) } // namespace Tyr #endif