]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/include/boost/parameter/value_type.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / parameter / include / boost / parameter / value_type.hpp
1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5 #ifndef BOOST_PARAMETER_VALUE_TYPE_060921_HPP
6 # define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
7
8 # include <boost/mpl/apply.hpp>
9 # include <boost/mpl/assert.hpp>
10 # include <boost/mpl/and.hpp>
11 # include <boost/parameter/aux_/result_of0.hpp>
12 # include <boost/parameter/aux_/void.hpp>
13 # include <boost/type_traits/is_same.hpp>
14
15 namespace boost { namespace parameter {
16
17 // A metafunction that, given an argument pack, returns the type of
18 // the parameter identified by the given keyword. If no such
19 // parameter has been specified, returns Default
20
21 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
22 template <class Parameters, class Keyword, class Default>
23 struct value_type0
24 {
25 typedef typename mpl::apply_wrap3<
26 typename Parameters::binding,Keyword,Default,mpl::false_
27 >::type type;
28
29 BOOST_MPL_ASSERT_NOT((
30 mpl::and_<
31 is_same<Default, void_>
32 , is_same<type, void_>
33 >
34 ));
35 };
36 # endif
37
38 template <class Parameters, class Keyword, class Default = void_>
39 struct value_type
40 {
41 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
42 typedef typename mpl::eval_if<
43 mpl::is_placeholder<Parameters>
44 , mpl::identity<int>
45 , value_type0<Parameters,Keyword,Default>
46 >::type type;
47 # else
48 typedef typename mpl::apply_wrap3<
49 typename Parameters::binding,Keyword,Default,mpl::false_
50 >::type type;
51
52 BOOST_MPL_ASSERT_NOT((
53 mpl::and_<
54 is_same<Default, void_>
55 , is_same<type, void_>
56 >
57 ));
58 # endif
59
60 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,value_type,(Parameters,Keyword,Default))
61 };
62
63 // A metafunction that, given an argument pack, returns the type of
64 // the parameter identified by the given keyword. If no such
65 // parameter has been specified, returns the type returned by invoking
66 // DefaultFn
67 template <class Parameters, class Keyword, class DefaultFn>
68 struct lazy_value_type
69 {
70 typedef typename mpl::apply_wrap3<
71 typename Parameters::binding
72 , Keyword
73 , typename aux::result_of0<DefaultFn>::type
74 , mpl::false_
75 >::type type;
76 };
77
78
79 }} // namespace boost::parameter
80
81 #endif // BOOST_PARAMETER_VALUE_TYPE_060921_HPP
82