Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright Daniel Wallin 2006.
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_PP_IMPL_UNWRAP_PREDICATE_HPP
0007 #define BOOST_PARAMETER_AUX_PP_IMPL_UNWRAP_PREDICATE_HPP
0008 
0009 namespace boost { namespace parameter { namespace aux {
0010 
0011     // Given Match, which is "void x" where x is an argument matching
0012     // criterion, extract a corresponding MPL predicate.
0013     template <typename Match>
0014     struct unwrap_predicate;
0015 }}} // namespace boost::parameter::aux
0016 
0017 #include <boost/parameter/aux_/always_true_predicate.hpp>
0018 
0019 namespace boost { namespace parameter { namespace aux {
0020 
0021     // Match anything
0022     template <>
0023     struct unwrap_predicate<void*>
0024     {
0025         typedef ::boost::parameter::aux::always_true_predicate type;
0026     };
0027 }}} // namespace boost::parameter::aux
0028 
0029 #include <boost/parameter/config.hpp>
0030 
0031 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
0032 #include <boost/parameter/aux_/void.hpp>
0033 #endif
0034 
0035 namespace boost { namespace parameter { namespace aux {
0036 
0037     // A matching predicate is explicitly specified.
0038 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
0039     template <typename Predicate>
0040     struct unwrap_predicate< ::boost::parameter::aux::voidstar(Predicate)>
0041     {
0042         typedef Predicate type;
0043     };
0044 #else
0045     template <typename Predicate>
0046     struct unwrap_predicate<void *(Predicate)>
0047     {
0048         typedef Predicate type;
0049     };
0050 #endif   // SunProCC workarounds needed.
0051 }}} // namespace boost::parameter::aux
0052 
0053 #include <boost/mpl/bool.hpp>
0054 #include <boost/mpl/if.hpp>
0055 
0056 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0057 #include <type_traits>
0058 #else
0059 #include <boost/mpl/placeholders.hpp>
0060 #include <boost/type_traits/is_convertible.hpp>
0061 #endif
0062 
0063 namespace boost { namespace parameter { namespace aux {
0064 
0065     // A type to which the argument is supposed to be convertible is
0066     // specified.
0067     template <typename Target>
0068     struct unwrap_predicate<void (Target)>
0069     {
0070 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0071         struct type
0072         {
0073             template <typename Argument, typename ArgumentPack>
0074             struct apply
0075               : ::boost::mpl::if_<
0076                     ::std::is_convertible<Argument,Target>
0077                   , ::boost::mpl::true_
0078                   , ::boost::mpl::false_
0079                 >
0080             {
0081             };
0082 
0083             template <typename Argument, typename ArgumentPack>
0084             using fn = ::std::is_convertible<Argument,Target>;
0085         };
0086 #else
0087         typedef ::boost::mpl::if_<
0088             ::boost::is_convertible< ::boost::mpl::_,Target>
0089           , ::boost::mpl::true_
0090           , ::boost::mpl::false_
0091         > type;
0092 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0093     };
0094 }}} // namespace boost::parameter::aux
0095 
0096 #endif  // include guard
0097