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_SATISFIES_HPP
7 #define BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
9 #include <boost/parameter/config.hpp>
11 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
12 #include <boost/parameter/aux_/arg_list.hpp>
13 #include <boost/parameter/aux_/augment_predicate.hpp>
14 #include <boost/parameter/aux_/void.hpp>
15 #include <boost/mpl/eval_if.hpp>
16 #include <boost/mpl/apply_wrap.hpp>
17 #include <boost/type_traits/is_same.hpp>
18 #else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
19 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
20 #include <boost/mp11/integral.hpp>
22 #include <boost/mpl/bool.hpp>
24 #include <boost/parameter/aux_/yesno.hpp>
25 #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
26 #endif // MSVC-7.1 workarounds needed
28 namespace boost { namespace parameter { namespace aux {
30 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
31 template <typename ArgList, typename ParameterRequirements, typename Bound>
33 : ::boost::parameter::aux::augment_predicate<
34 typename ParameterRequirements::predicate
35 , typename ArgList::reference
36 , typename ArgList::key_type
44 // Returns mpl::true_ iff the given ParameterRequirements are satisfied by
46 template <typename ArgList, typename ParameterRequirements>
47 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
48 using satisfies = ::boost::mp11::mp_bool<
50 ::boost::parameter::aux::to_yesno(
52 static_cast<ParameterRequirements*>(
53 BOOST_PARAMETER_AUX_PP_NULLPTR
55 , static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
58 ) == sizeof(::boost::parameter::aux::yes_tag)
60 #else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
63 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
64 // VC7.1 can't handle the sizeof() implementation below,
65 // so we use this instead.
66 typedef typename ::boost::mpl::apply_wrap3<
67 typename ArgList::binding
68 , typename ParameterRequirements::keyword
69 , ::boost::parameter::void_
70 , ::boost::mpl::false_
74 typedef typename ::boost::mpl::eval_if<
75 ::boost::is_same<_bound,::boost::parameter::void_>
76 , typename ParameterRequirements::has_default
77 , ::boost::mpl::eval_if<
80 , ::boost::parameter::aux::empty_arg_list
82 , ::boost::mpl::false_
83 , ::boost::parameter::aux::satisfies_impl<
85 , ParameterRequirements
90 #else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
91 BOOST_STATIC_CONSTANT(
94 ::boost::parameter::aux::to_yesno(
96 static_cast<ParameterRequirements*>(
97 BOOST_PARAMETER_AUX_PP_NULLPTR
99 , static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
102 ) == sizeof(::boost::parameter::aux::yes_tag)
107 typedef ::boost::mpl::bool_<
108 ::boost::parameter::aux
109 ::satisfies<ArgList,ParameterRequirements>::_value
111 #endif // MSVC-7.1 workarounds needed
113 #endif // BOOST_PARAMETER_CAN_USE_MP11
114 }}} // namespace boost::parameter::aux
116 #include <boost/parameter/aux_/pack/as_parameter_requirements.hpp>
118 namespace boost { namespace parameter { namespace aux {
120 // Returns mpl::true_ if the requirements of the given ParameterSpec
121 // are satisfied by ArgList.
122 template <typename ArgList, typename ParameterSpec>
123 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
124 using satisfies_requirements_of = ::boost::parameter::aux::satisfies<
126 , typename ::boost::parameter::aux
127 ::as_parameter_requirements<ParameterSpec>::type
130 struct satisfies_requirements_of
131 : ::boost::parameter::aux::satisfies<
133 , typename ::boost::parameter::aux
134 ::as_parameter_requirements<ParameterSpec>::type
138 #endif // BOOST_PARAMETER_CAN_USE_MP11
139 }}} // namespace boost::parameter::aux
141 #endif // include guard