File indexing completed on 2024-09-22 04:53:11

0001 /*
0002  * SPDX-FileCopyrightText: 2008 Trevor Pounds
0003  * SPDX-License-Identifier: MIT
0004  */
0005 
0006 #ifndef __MOCKITOPP_CXX0X_STATIC_ASSERT_HPP__
0007 #define __MOCKITOPP_CXX0X_STATIC_ASSERT_HPP__
0008 
0009 namespace mockitopp
0010 {
0011    namespace detail
0012    {
0013       /**
0014        * An emulation of the C++0x static_assert macro that can be
0015        * used to force a compile time error in older compilers.
0016        *
0017        * @author Trevor Pounds
0018        */
0019       template <bool E> struct static_assert_impl { typedef bool type; };
0020       template <> struct static_assert_impl<false> { };
0021 
0022       #define mockitopp_static_assert(constant_expression) \
0023          typedef typename ::mockitopp::detail::static_assert_impl<constant_expression>::type MOCKITOPP_STATIC_ASSERT_TYPE;
0024    } // namespace detail
0025 } // namespace mockitopp
0026 
0027 #endif //__MOCKITOPP_CXX0X_STATIC_ASSERT_HPP__