Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:30

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_DEDUCED_HPP
0007 #define BOOST_PARAMETER_DEDUCED_HPP
0008 
0009 #include <boost/parameter/aux_/use_default.hpp>
0010 
0011 namespace boost { namespace parameter {
0012 
0013     // This metafunction can be used to describe the treatment of particular
0014     // named parameters for the purposes of overload elimination with SFINAE,
0015     // by placing specializations in the parameters<...> list.
0016     //
0017     // If a keyword k is specified with deduced<...>, that keyword
0018     // will be automatically deduced from the argument list.
0019     template <typename Tag>
0020     struct deduced
0021     {
0022         typedef Tag key_type;
0023     };
0024 }}
0025 
0026 #include <boost/parameter/config.hpp>
0027 
0028 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0029 #include <boost/mp11/integral.hpp>
0030 #else
0031 #include <boost/mpl/bool.hpp>
0032 #endif
0033 
0034 namespace boost { namespace parameter { namespace aux {
0035 
0036     template <typename T>
0037     struct is_deduced_aux
0038 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0039       : ::boost::mp11::mp_false
0040 #else
0041       : ::boost::mpl::false_
0042 #endif
0043     {
0044     };
0045 
0046     template <typename Tag>
0047     struct is_deduced_aux< ::boost::parameter::deduced<Tag> >
0048 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0049       : ::boost::mp11::mp_true
0050 #else
0051       : ::boost::mpl::true_
0052 #endif
0053     {
0054     };
0055 
0056     template <typename T>
0057     struct is_deduced0
0058       : ::boost::parameter::aux::is_deduced_aux<typename T::key_type>::type
0059     {
0060     };
0061 }}} // namespace boost::parameter::aux
0062 
0063 #include <boost/parameter/required.hpp>
0064 #include <boost/parameter/optional.hpp>
0065 
0066 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0067 #include <boost/mp11/utility.hpp>
0068 #else
0069 #include <boost/mpl/if.hpp>
0070 #endif
0071 
0072 namespace boost { namespace parameter { namespace aux {
0073 
0074     //
0075     // tag_type, has_default, and predicate --
0076     //
0077     // These metafunctions accept a ParameterSpec and extract the
0078     // keyword tag, whether or not a default is supplied for the
0079     // parameter, and the predicate that the corresponding actual
0080     // argument type is required match.
0081     //
0082     // a ParameterSpec is a specialization of either keyword<...>,
0083     // required<...>, optional<...>
0084     //
0085 
0086     template <typename T>
0087 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0088     using has_default = ::boost::mp11::mp_if<
0089         ::boost::parameter::aux::is_required<T>
0090       , ::boost::mp11::mp_false
0091       , ::boost::mp11::mp_true
0092     >;
0093 #else
0094     struct has_default
0095       : ::boost::mpl::if_<
0096             ::boost::parameter::aux::is_required<T>
0097           , ::boost::mpl::false_
0098           , ::boost::mpl::true_
0099         >::type
0100     {
0101     };
0102 #endif
0103 
0104     template <typename T>
0105 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0106     using is_deduced = ::boost::mp11::mp_if<
0107         ::boost::mp11::mp_if<
0108             ::boost::parameter::aux::is_optional<T>
0109           , ::boost::mp11::mp_true
0110           , ::boost::parameter::aux::is_required<T>
0111         >
0112       , ::boost::parameter::aux::is_deduced0<T>
0113       , ::boost::mp11::mp_false
0114     >;
0115 #else
0116     struct is_deduced
0117       : ::boost::mpl::if_<
0118             typename ::boost::mpl::if_<
0119                 ::boost::parameter::aux::is_optional<T>
0120               , ::boost::mpl::true_
0121               , ::boost::parameter::aux::is_required<T>
0122             >::type
0123           , ::boost::parameter::aux::is_deduced0<T>
0124           , ::boost::mpl::false_
0125         >::type
0126     {
0127     };
0128 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0129 }}} // namespace boost::parameter::aux
0130 
0131 #endif  // include guard
0132