1 // Copyright David Abrahams, Daniel Wallin 2003.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_PARAMETER_DEDUCED_HPP
7 #define BOOST_PARAMETER_DEDUCED_HPP
9 #include <boost/parameter/aux_/use_default.hpp>
11 namespace boost { namespace parameter {
13 // This metafunction can be used to describe the treatment of particular
14 // named parameters for the purposes of overload elimination with SFINAE,
15 // by placing specializations in the parameters<...> list.
17 // If a keyword k is specified with deduced<...>, that keyword
18 // will be automatically deduced from the argument list.
19 template <typename Tag>
26 #include <boost/parameter/config.hpp>
28 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
29 #include <boost/mp11/integral.hpp>
31 #include <boost/mpl/bool.hpp>
34 namespace boost { namespace parameter { namespace aux {
38 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
39 : ::boost::mp11::mp_false
41 : ::boost::mpl::false_
46 template <typename Tag>
47 struct is_deduced_aux< ::boost::parameter::deduced<Tag> >
48 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
49 : ::boost::mp11::mp_true
58 : ::boost::parameter::aux::is_deduced_aux<typename T::key_type>::type
61 }}} // namespace boost::parameter::aux
63 #include <boost/parameter/required.hpp>
64 #include <boost/parameter/optional.hpp>
66 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
67 #include <boost/mp11/utility.hpp>
69 #include <boost/mpl/if.hpp>
72 namespace boost { namespace parameter { namespace aux {
75 // tag_type, has_default, and predicate --
77 // These metafunctions accept a ParameterSpec and extract the
78 // keyword tag, whether or not a default is supplied for the
79 // parameter, and the predicate that the corresponding actual
80 // argument type is required match.
82 // a ParameterSpec is a specialization of either keyword<...>,
83 // required<...>, optional<...>
87 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
88 using has_default = ::boost::mp11::mp_if<
89 ::boost::parameter::aux::is_required<T>
90 , ::boost::mp11::mp_false
91 , ::boost::mp11::mp_true
96 ::boost::parameter::aux::is_required<T>
97 , ::boost::mpl::false_
104 template <typename T>
105 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
106 using is_deduced = ::boost::mp11::mp_if<
107 ::boost::mp11::mp_if<
108 ::boost::parameter::aux::is_optional<T>
109 , ::boost::mp11::mp_true
110 , ::boost::parameter::aux::is_required<T>
112 , ::boost::parameter::aux::is_deduced0<T>
113 , ::boost::mp11::mp_false
118 typename ::boost::mpl::if_<
119 ::boost::parameter::aux::is_optional<T>
120 , ::boost::mpl::true_
121 , ::boost::parameter::aux::is_required<T>
123 , ::boost::parameter::aux::is_deduced0<T>
124 , ::boost::mpl::false_
128 #endif // BOOST_PARAMETER_CAN_USE_MP11
129 }}} // namespace boost::parameter::aux
131 #endif // include guard