]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | |
2 | // Copyright 2017 Peter Dimov. | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // | |
6 | // See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
92f5a8d4 | 9 | #include <boost/mp11/detail/config.hpp> |
b32b8144 | 10 | |
92f5a8d4 | 11 | #if !defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) |
b32b8144 FG |
12 | |
13 | int main() {} | |
14 | ||
15 | #else | |
16 | ||
17 | #include <boost/mp11/algorithm.hpp> | |
18 | #include <boost/core/lightweight_test.hpp> | |
b32b8144 FG |
19 | |
20 | using boost::mp11::mp_size_t; | |
21 | using boost::mp11::mp_with_index; | |
22 | ||
23 | struct F | |
24 | { | |
25 | template<std::size_t I> constexpr std::size_t operator()( mp_size_t<I> ) const | |
26 | { | |
27 | return I; | |
28 | } | |
29 | }; | |
30 | ||
31 | #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) | |
32 | ||
33 | int main() | |
34 | { | |
35 | constexpr std::size_t i = mp_with_index<64>( 57, F{} ); | |
36 | STATIC_ASSERT( i == 57 ); | |
37 | } | |
38 | ||
39 | #endif |