// Copyright 2025 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #if defined(BOOST_NO_CXX11_CONSTEXPR) BOOST_PRAGMA_MESSAGE("Test skipped because BOOST_NO_CXX11_CONSTEXPR is defined") #else #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) template void test1() { constexpr boost::array a = {}; STATIC_ASSERT( a.size() == N ); STATIC_ASSERT( a.empty() == (N == 0) ); STATIC_ASSERT( a.max_size() == N ); } template void test2() { typedef boost::array A; STATIC_ASSERT( A().size() == N ); STATIC_ASSERT( A().empty() == (N == 0) ); STATIC_ASSERT( A().max_size() == N ); } // the functions are static, which deviates from the standard template void test3() { typedef boost::array A; STATIC_ASSERT( A::size() == N ); STATIC_ASSERT( A::empty() == (N == 0) ); STATIC_ASSERT( A::max_size() == N ); STATIC_ASSERT( A::static_size == N ); } int main() { test1(); test1(); test1(); test2(); test2(); test2(); test3(); test3(); test3(); } #endif