$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00019 template<bool ERROR___INCORRECT_OR_UNSUPPORTED_TYPE> 00020 struct arma_type_check_cxx1998 00021 { 00022 arma_inline 00023 static 00024 void 00025 apply() 00026 { 00027 static const char 00028 junk[ ERROR___INCORRECT_OR_UNSUPPORTED_TYPE ? -1 : +1 ]; 00029 } 00030 }; 00031 00032 00033 00034 template<> 00035 struct arma_type_check_cxx1998<false> 00036 { 00037 arma_inline 00038 static 00039 void 00040 apply() 00041 { 00042 } 00043 }; 00044 00045 00046 00047 #if !defined(ARMA_USE_CXX11) 00048 00049 #define arma_static_check(condition, message) static const char message[ (condition) ? -1 : +1 ] 00050 00051 #define arma_type_check(condition) arma_type_check_cxx1998<condition>::apply() 00052 00053 #else 00054 00055 #define arma_static_check(condition, message) static_assert( !(condition), #message ) 00056 00057 #define arma_type_check(condition) static_assert( !(condition), "error: incorrect or unsupported type" ) 00058 00059 #endif 00060 00061 00062