CARMA C++
compileTimeCheck.h
1 #ifndef CARMA_UTIL_COMPILE_TIME_CHECK_H
2 #define CARMA_UTIL_COMPILE_TIME_CHECK_H
3 
4 
5 namespace carma {
6 namespace util {
7 
8 
9 template < bool assertion >
10 void compileTimeCheck( );
11 
12 
13 template < >
14 inline void compileTimeCheck< true >( ) { }
15 
16 
17 template < bool assertion >
18 inline void compileTimeCheck( ) {
19  struct your_compile_time_assertion_failed;
20 
21  if ( sizeof( your_compile_time_assertion_failed ) != 3 )
22  throw 11;
23 }
24 
25 
26 } // namespace carma::util
27 } // namespace carma
28 
29 
30 #endif