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_AUX_PACK_PREDICATE_HPP
7 #define BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
9 namespace boost { namespace parameter { namespace aux {
11 // helper for get_predicate<...>, below
13 struct get_predicate_or_default
18 // helper for predicate<...>, below
21 : ::boost::parameter::aux
22 ::get_predicate_or_default<typename T::predicate>
25 }}} // namespace boost::parameter::aux
27 #include <boost/parameter/aux_/use_default.hpp>
28 #include <boost/parameter/aux_/always_true_predicate.hpp>
30 namespace boost { namespace parameter { namespace aux {
33 struct get_predicate_or_default< ::boost::parameter::aux::use_default>
35 typedef ::boost::parameter::aux::always_true_predicate type;
37 }}} // namespace boost::parameter::aux
39 #include <boost/parameter/required.hpp>
40 #include <boost/parameter/optional.hpp>
41 #include <boost/parameter/config.hpp>
43 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
44 #include <boost/mp11/integral.hpp>
45 #include <boost/mp11/utility.hpp>
47 #include <boost/mpl/bool.hpp>
48 #include <boost/mpl/if.hpp>
49 #include <boost/mpl/eval_if.hpp>
50 #include <boost/mpl/identity.hpp>
53 namespace boost { namespace parameter { namespace aux {
56 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
57 using predicate = ::boost::mp11::mp_if<
59 ::boost::parameter::aux::is_optional<T>
60 , ::boost::mp11::mp_true
61 , ::boost::parameter::aux::is_required<T>
63 , ::boost::parameter::aux::get_predicate<T>
64 , ::boost::mp11::mp_identity<
65 ::boost::parameter::aux::always_true_predicate
70 : ::boost::mpl::eval_if<
71 typename ::boost::mpl::if_<
72 ::boost::parameter::aux::is_optional<T>
74 , ::boost::parameter::aux::is_required<T>
76 , ::boost::parameter::aux::get_predicate<T>
77 , ::boost::mpl::identity<
78 ::boost::parameter::aux::always_true_predicate
83 #endif // BOOST_PARAMETER_CAN_USE_MP11
84 }}} // namespace boost::parameter::aux
86 #endif // include guard