static_assert.h

Go to the documentation of this file.
00001 00006 /* 00007 * Copyright © 2000, 2001 Sofus Mortensen 00008 * 00009 * This material is provided "as is", with absolutely no warranty 00010 * expressed or implied. Any use is at your own risk. Permission to 00011 * use or copy this software for any purpose is hereby granted without 00012 * fee, provided the above notices are retained on all copies. 00013 * Permission to modify the code and to distribute modified code is 00014 * granted, provided the above notices are retained, and a notice that 00015 * the code was modified is included with the above copyright notice. 00016 * 00017 * This header is part of comet. 00018 * http://www.lambdasoft.dk/comet 00019 */ 00020 00021 #ifndef COMET_STATIC_ASSERT_H 00022 #define COMET_STATIC_ASSERT_H 00023 00024 #include <comet/config.h> 00025 00026 // (C) Copyright John Maddock 2000. 00027 // Permission to copy, use, modify, sell and 00028 // distribute this software is granted provided this copyright notice appears 00029 // in all copies. This software is provided "as is" without express or implied 00030 // warranty, and with no claim as to its suitability for any purpose. 00031 00032 // See http://www.boost.org for most recent version including documentation. 00033 00034 /* 00035 Revision history: 00036 02 August 2000 00037 Initial version. 00038 */ 00039 00040 namespace comet { 00041 namespace impl { 00042 00043 template <bool> struct COMPILE_TIME_ASSERTION_FAILURE; 00044 00045 template <> struct COMPILE_TIME_ASSERTION_FAILURE<true>{}; 00046 00047 template<int> struct ct_assert_test{}; 00048 00049 } 00050 } 00051 00052 #define COMET_STATIC_ASSERT( B ) typedef ::comet::impl::ct_assert_test<sizeof(::comet::impl::COMPILE_TIME_ASSERTION_FAILURE< ( B ) >)> comet_static_assert_typedef_ 00053 00054 #endif