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_OPTIONAL_HPP
7 #define BOOST_PARAMETER_OPTIONAL_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     //   - The actual argument type matched by every keyword tag
19     //     associated with a predicate must satisfy that predicate
20     //
21     //   - If a keyword k is specified without an optional<...> or
22     //     required<...> wrapper, it is treated as though
23     //     optional<k> were specified.
24     template <
25         typename Tag
26       , typename Predicate = ::boost::parameter::aux::use_default
27     >
28     struct optional
29     {
30         typedef Tag key_type;
31         typedef Predicate predicate;
32     };
33 }}
34 
35 #include <boost/parameter/config.hpp>
36 
37 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
38 #include <boost/mp11/integral.hpp>
39 #else
40 #include <boost/mpl/bool.hpp>
41 #endif
42 
43 namespace boost { namespace parameter { namespace aux {
44 
45     template <typename T>
46     struct is_optional
47 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
48       : ::boost::mp11::mp_false
49 #else
50       : ::boost::mpl::false_
51 #endif
52     {
53     };
54 
55     template <typename Tag, typename Predicate>
56     struct is_optional< ::boost::parameter::optional<Tag,Predicate> >
57 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
58       : ::boost::mp11::mp_true
59 #else
60       : ::boost::mpl::true_
61 #endif
62     {
63     };
64 }}} // namespace boost::parameter::aux
65 
66 #endif  // include guard
67 
68