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) 5 6 #ifndef BOOST_PARAMETER_REQUIRED_HPP 7 #define BOOST_PARAMETER_REQUIRED_HPP 8 9 #include <boost/parameter/aux_/use_default.hpp> 10 11 namespace boost { namespace parameter { 12 13 // This metafunction can be used to describe the treatment of particular 14 // named parameters for the purposes of overload elimination with SFINAE, 15 // by placing specializations in the parameters<...> list. In order for 16 // a treated function to participate in overload resolution: 17 // 18 // - all keyword tags wrapped in required<...> must have a matching 19 // actual argument 20 // 21 // - The actual argument type matched by every keyword tag 22 // associated with a predicate must satisfy that predicate 23 template < 24 typename Tag 25 , typename Predicate = ::boost::parameter::aux::use_default 26 > 27 struct required 28 { 29 typedef Tag key_type; 30 typedef Predicate predicate; 31 }; 32 }} 33 34 #include <boost/parameter/config.hpp> 35 36 #if defined(BOOST_PARAMETER_CAN_USE_MP11) 37 #include <boost/mp11/integral.hpp> 38 #else 39 #include <boost/mpl/bool.hpp> 40 #endif 41 42 namespace boost { namespace parameter { namespace aux { 43 44 template <typename T> 45 struct is_required 46 #if defined(BOOST_PARAMETER_CAN_USE_MP11) 47 : ::boost::mp11::mp_false 48 #else 49 : ::boost::mpl::false_ 50 #endif 51 { 52 }; 53 54 template <typename Tag, typename Predicate> 55 struct is_required< ::boost::parameter::required<Tag,Predicate> > 56 #if defined(BOOST_PARAMETER_CAN_USE_MP11) 57 : ::boost::mp11::mp_true 58 #else 59 : ::boost::mpl::true_ 60 #endif 61 { 62 }; 63 }}} // namespace boost::parameter::aux 64 65 #endif // include guard 66 67