static_check.h

00001 
00002 // The Loki Library
00003 // Copyright (c) 2001 by Andrei Alexandrescu
00004 // This code accompanies the book:
00005 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 
00006 //     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
00007 // Permission to use, copy, modify, distribute and sell this software for any 
00008 //     purpose is hereby granted without fee, provided that the above copyright 
00009 //     notice appear in all copies and that both that copyright notice and this 
00010 //     permission notice appear in supporting documentation.
00011 // The author or Addison-Wesley Longman make no representations about the 
00012 //     suitability of this software for any purpose. It is provided "as is" 
00013 //     without express or implied warranty.
00015 #ifndef LOKI_STATIC_CHECK_INC_
00016 #define LOKI_STATIC_CHECK_INC_
00017 
00018 // $Id: static_check.h 752 2006-10-17 19:52:18Z syntheticpp $
00019 
00020 
00021 namespace Loki
00022 {
00024 // Helper structure for the STATIC_CHECK macro
00026 
00027     template<int> struct CompileTimeError;
00028     template<> struct CompileTimeError<true> {};
00029 }
00030 
00032 // macro STATIC_CHECK
00033 // Invocation: STATIC_CHECK(expr, id)
00034 // where:
00035 // expr is a compile-time integral or pointer expression
00036 // id is a C++ identifier that does not need to be defined
00037 // If expr is zero, id will appear in a compile-time error message.
00039 
00040 #define LOKI_STATIC_CHECK(expr, msg) \
00041     { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } 
00042 
00043 
00044 #endif // end file guardian
00045 

Generated on Sun Feb 25 16:52:28 2007 for Loki by  doxygen 1.5.1-p1