max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup arma_static_check max@0: //! @{ max@0: max@0: max@0: max@0: template max@0: struct arma_type_check_cxx1998 max@0: { max@0: arma_inline max@0: static max@0: void max@0: apply() max@0: { max@0: static const char max@0: junk[ ERROR___INCORRECT_OR_UNSUPPORTED_TYPE ? -1 : +1 ]; max@0: } max@0: }; max@0: max@0: max@0: max@0: template<> max@0: struct arma_type_check_cxx1998 max@0: { max@0: arma_inline max@0: static max@0: void max@0: apply() max@0: { max@0: } max@0: }; max@0: max@0: max@0: max@0: #if !defined(ARMA_USE_CXX11) max@0: max@0: #define arma_static_check(condition, message) static const char message[ (condition) ? -1 : +1 ] max@0: max@0: #define arma_type_check(condition) arma_type_check_cxx1998::apply() max@0: max@0: #else max@0: max@0: #define arma_static_check(condition, message) static_assert( !(condition), #message ) max@0: max@0: #define arma_type_check(condition) static_assert( !(condition), "error: incorrect or unsupported type" ) max@0: max@0: #endif max@0: max@0: max@0: max@0: //! @}