68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
// Copyright David Abrahams, Daniel Wallin 2003.
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
#ifndef ACTIV_BOOST_PARAMETER_OPTIONAL_HPP
|
|
#define ACTIV_BOOST_PARAMETER_OPTIONAL_HPP
|
|
|
|
#include <ActivBoost/parameter/aux_/use_default.hpp>
|
|
|
|
namespace Boost { namespace parameter {
|
|
|
|
// This metafunction can be used to describe the treatment of particular
|
|
// named parameters for the purposes of overload elimination with SFINAE,
|
|
// by placing specializations in the parameters<...> list. In order for
|
|
// a treated function to participate in overload resolution:
|
|
//
|
|
// - The actual argument type matched by every keyword tag
|
|
// associated with a predicate must satisfy that predicate
|
|
//
|
|
// - If a keyword k is specified without an optional<...> or
|
|
// required<...> wrapper, it is treated as though
|
|
// optional<k> were specified.
|
|
template <
|
|
typename Tag
|
|
, typename Predicate = ::Boost::parameter::aux::use_default
|
|
>
|
|
struct optional
|
|
{
|
|
typedef Tag key_type;
|
|
typedef Predicate predicate;
|
|
};
|
|
}}
|
|
|
|
#include <ActivBoost/parameter/config.hpp>
|
|
|
|
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
|
|
#include <ActivBoost/mp11/integral.hpp>
|
|
#else
|
|
#include <ActivBoost/mpl/bool.hpp>
|
|
#endif
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename T>
|
|
struct is_optional
|
|
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
|
|
: ::Boost::mp11::mp_false
|
|
#else
|
|
: ::Boost::mpl::false_
|
|
#endif
|
|
{
|
|
};
|
|
|
|
template <typename Tag, typename Predicate>
|
|
struct is_optional< ::Boost::parameter::optional<Tag,Predicate> >
|
|
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
|
|
: ::Boost::mp11::mp_true
|
|
#else
|
|
: ::Boost::mpl::true_
|
|
#endif
|
|
{
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#endif // include guard
|
|
|