]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/compile_time/sfinae_friendly.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / test / compile_time / sfinae_friendly.hpp
1 /*=============================================================================
2 Copyright (c) 2015 Kohei Takahashi
3
4 Use modification and distribution are subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
8
9 #ifndef FUSION_TEST_SFINAE_FRIENDLY_HPP
10 #define FUSION_TEST_SFINAE_FRIENDLY_HPP
11
12 #include <boost/config.hpp>
13 #include <boost/mpl/bool.hpp>
14 #include <boost/mpl/assert.hpp>
15 #include <boost/utility/result_of.hpp>
16 #include <boost/core/enable_if.hpp>
17
18 #if !defined(BOOST_NO_SFINAE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
19
20 #include <boost/fusion/container/vector.hpp>
21
22 namespace sfinae_friendly
23 {
24 template <typename> struct arg_;
25 template <typename R, typename T> struct arg_<R(T)> { typedef T type; };
26
27 template <typename Traits, typename = void>
28 struct check
29 : boost::mpl::true_ { };
30
31 template <typename Traits>
32 struct check<Traits, typename boost::enable_if_has_type<typename Traits::type>::type>
33 : boost::mpl::false_ { };
34
35 struct unspecified {};
36 typedef boost::fusion::vector<> v0;
37 typedef boost::fusion::vector<unspecified> v1;
38 typedef boost::fusion::vector<unspecified, unspecified> v2;
39 typedef boost::fusion::vector<unspecified, unspecified, unspecified> v3;
40 }
41
42 #define SFINAE_FRIENDLY_ASSERT(Traits) \
43 BOOST_MPL_ASSERT((::sfinae_friendly::check<typename ::sfinae_friendly::arg_<void Traits>::type>))
44
45 #else
46
47 #define SFINAE_FRIENDLY_ASSERT(Traits) \
48 BOOST_MPL_ASSERT((boost::mpl::true_))
49
50 #endif
51
52 #endif // FUSION_TEST_SFINAE_FRIENDLY_HPP
53