]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/tuple_for_each_cx.cpp
2 // Copyright 2015 Peter Dimov.
4 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
11 #pragma warning( disable: 4244 ) // 'initializing': conversion from 'int' to 'char', possible loss of data
14 #include <boost/mp11/tuple.hpp>
15 #include <boost/mp11/detail/config.hpp>
17 // Technically std::tuple isn't constexpr enabled in C++11, but it works with libstdc++
19 #if defined( BOOST_MP11_NO_CONSTEXPR ) || ( !defined(_MSC_VER) && !defined( __GLIBCXX__ ) && __cplusplus < 201400L )
26 #include <type_traits>
28 struct assert_is_integral
30 template<class T
> constexpr bool operator()( T
) const
32 static_assert( std::is_integral
<T
>::value
, "T must be an integral type" );
40 constexpr std::tuple
<int, short, char> tp
{ 1, 2, 3 };
41 constexpr auto r
= boost::mp11::tuple_for_each( tp
, assert_is_integral() );
45 #if defined( __clang_major__ ) && __clang_major__ == 3 && __clang_minor__ < 9
46 // "error: default initialization of an object of const type 'const std::tuple<>' without a user-provided default constructor"
50 constexpr std::tuple
<> tp
;
51 constexpr auto r
= boost::mp11::tuple_for_each( tp
, 11 );
52 static_assert( r
== 11, "r == 11" );