Files

88 lines
2.6 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_AUX_PACK_PREDICATE_HPP
#define ACTIV_BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
namespace Boost { namespace parameter { namespace aux {
// helper for get_predicate<...>, below
template <typename T>
struct get_predicate_or_default
{
typedef T type;
};
// helper for predicate<...>, below
template <typename T>
struct get_predicate
: ::Boost::parameter::aux
::get_predicate_or_default<typename T::predicate>
{
};
}}} // namespace Boost::parameter::aux
#include <ActivBoost/parameter/aux_/use_default.hpp>
#include <ActivBoost/parameter/aux_/always_true_predicate.hpp>
namespace Boost { namespace parameter { namespace aux {
template <>
struct get_predicate_or_default< ::Boost::parameter::aux::use_default>
{
typedef ::Boost::parameter::aux::always_true_predicate type;
};
}}} // namespace Boost::parameter::aux
#include <ActivBoost/parameter/required.hpp>
#include <ActivBoost/parameter/optional.hpp>
#include <ActivBoost/parameter/config.hpp>
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
#include <ActivBoost/mp11/integral.hpp>
#include <ActivBoost/mp11/utility.hpp>
#else
#include <ActivBoost/mpl/bool.hpp>
#include <ActivBoost/mpl/if.hpp>
#include <ActivBoost/mpl/eval_if.hpp>
#include <ActivBoost/mpl/identity.hpp>
#endif
namespace Boost { namespace parameter { namespace aux {
template <typename T>
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
using predicate = ::Boost::mp11::mp_if<
::Boost::mp11::mp_if<
::Boost::parameter::aux::is_optional<T>
, ::Boost::mp11::mp_true
, ::Boost::parameter::aux::is_required<T>
>
, ::Boost::parameter::aux::get_predicate<T>
, ::Boost::mp11::mp_identity<
::Boost::parameter::aux::always_true_predicate
>
>;
#else
struct predicate
: ::Boost::mpl::eval_if<
typename ::Boost::mpl::if_<
::Boost::parameter::aux::is_optional<T>
, ::Boost::mpl::true_
, ::Boost::parameter::aux::is_required<T>
>::type
, ::Boost::parameter::aux::get_predicate<T>
, ::Boost::mpl::identity<
::Boost::parameter::aux::always_true_predicate
>
>
{
};
#endif // ACTIV_BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace Boost::parameter::aux
#endif // include guard