Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:20:35

0001 // Copyright David Abrahams, Daniel Wallin 2003.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // (See accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
0007 #define BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
0008 
0009 #include <boost/parameter/config.hpp>
0010 
0011 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
0012 #include <boost/parameter/aux_/arg_list.hpp>
0013 #include <boost/parameter/aux_/augment_predicate.hpp>
0014 #include <boost/parameter/aux_/void.hpp>
0015 #include <boost/mpl/eval_if.hpp>
0016 #include <boost/mpl/apply_wrap.hpp>
0017 #include <boost/type_traits/is_same.hpp>
0018 #else   // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
0019 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0020 #include <boost/mp11/integral.hpp>
0021 #else
0022 #include <boost/mpl/bool.hpp>
0023 #endif
0024 #include <boost/parameter/aux_/yesno.hpp>
0025 #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
0026 #endif  // MSVC-7.1 workarounds needed
0027 
0028 namespace boost { namespace parameter { namespace aux {
0029 
0030 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
0031     template <typename ArgList, typename ParameterRequirements, typename Bound>
0032     struct satisfies_impl
0033       : ::boost::parameter::aux::augment_predicate<
0034             typename ParameterRequirements::predicate
0035           , typename ArgList::reference
0036           , typename ArgList::key_type
0037           , Bound
0038           , ArgList
0039         >
0040     {
0041     };
0042 #endif
0043 
0044     // Returns mpl::true_ iff the given ParameterRequirements are satisfied by
0045     // ArgList.
0046     template <typename ArgList, typename ParameterRequirements>
0047 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0048     using satisfies = ::boost::mp11::mp_bool<
0049         sizeof(
0050             ::boost::parameter::aux::to_yesno(
0051                 ArgList::satisfies(
0052                     static_cast<ParameterRequirements*>(
0053                         BOOST_PARAMETER_AUX_PP_NULLPTR
0054                     )
0055                   , static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
0056                 )
0057             )
0058         ) == sizeof(::boost::parameter::aux::yes_tag)
0059     >;
0060 #else   // !defined(BOOST_PARAMETER_CAN_USE_MP11)
0061     class satisfies
0062     {
0063 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
0064         // VC7.1 can't handle the sizeof() implementation below,
0065         // so we use this instead.
0066         typedef typename ::boost::mpl::apply_wrap3<
0067             typename ArgList::binding
0068           , typename ParameterRequirements::keyword
0069           , ::boost::parameter::void_
0070           , ::boost::mpl::false_
0071         >::type _bound;
0072 
0073      public:
0074         typedef typename ::boost::mpl::eval_if<
0075             ::boost::is_same<_bound,::boost::parameter::void_>
0076           , typename ParameterRequirements::has_default
0077           , ::boost::mpl::eval_if<
0078                 ::boost::is_same<
0079                     ArgList
0080                   , ::boost::parameter::aux::empty_arg_list
0081                 >
0082               , ::boost::mpl::false_
0083               , ::boost::parameter::aux::satisfies_impl<
0084                     ArgList
0085                   , ParameterRequirements
0086                   , _bound
0087                 >
0088             >
0089         >::type type;
0090 #else   // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
0091         BOOST_STATIC_CONSTANT(
0092             bool, _value = (
0093                 sizeof(
0094                     ::boost::parameter::aux::to_yesno(
0095                         ArgList::satisfies(
0096                             static_cast<ParameterRequirements*>(
0097                                 BOOST_PARAMETER_AUX_PP_NULLPTR
0098                             )
0099                           , static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
0100                         )
0101                     )
0102                 ) == sizeof(::boost::parameter::aux::yes_tag)
0103             )
0104         );
0105 
0106      public:
0107         typedef ::boost::mpl::bool_<
0108             ::boost::parameter::aux
0109             ::satisfies<ArgList,ParameterRequirements>::_value
0110         > type;
0111 #endif  // MSVC-7.1 workarounds needed
0112     };
0113 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0114 }}} // namespace boost::parameter::aux
0115 
0116 #include <boost/parameter/aux_/pack/as_parameter_requirements.hpp>
0117 
0118 namespace boost { namespace parameter { namespace aux {
0119 
0120     // Returns mpl::true_ if the requirements of the given ParameterSpec
0121     // are satisfied by ArgList.
0122     template <typename ArgList, typename ParameterSpec>
0123 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0124     using satisfies_requirements_of = ::boost::parameter::aux::satisfies<
0125         ArgList
0126       , typename ::boost::parameter::aux
0127         ::as_parameter_requirements<ParameterSpec>::type
0128     >;
0129 #else
0130     struct satisfies_requirements_of
0131       : ::boost::parameter::aux::satisfies<
0132             ArgList
0133           , typename ::boost::parameter::aux
0134             ::as_parameter_requirements<ParameterSpec>::type
0135         >::type
0136     {
0137     };
0138 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0139 }}} // namespace boost::parameter::aux
0140 
0141 #endif  // include guard
0142