mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
policy_cache.hpp
This commit is contained in:
parent
f5c5a1a991
commit
8183fc5114
2054 changed files with 473146 additions and 1 deletions
42
src/boost/parameter/aux_/always_true_predicate.hpp
Normal file
42
src/boost/parameter/aux_/always_true_predicate.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright Cromwell D. Enage 2019.
|
||||
// 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 BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
|
||||
#define BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#endif
|
||||
#else
|
||||
#include <boost/mpl/always.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
struct always_true_predicate
|
||||
{
|
||||
template <typename ...>
|
||||
struct apply
|
||||
{
|
||||
typedef ::boost::mpl::true_ type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename ...>
|
||||
using fn = ::boost::mp11::mp_true;
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
typedef ::boost::mpl::always< ::boost::mpl::true_> always_true_predicate;
|
||||
#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
1331
src/boost/parameter/aux_/arg_list.hpp
Normal file
1331
src/boost/parameter/aux_/arg_list.hpp
Normal file
File diff suppressed because it is too large
Load diff
198
src/boost/parameter/aux_/augment_predicate.hpp
Normal file
198
src/boost/parameter/aux_/augment_predicate.hpp
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
// Copyright Cromwell D. Enage 2018.
|
||||
// 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 BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
|
||||
#define BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
|
||||
|
||||
#include <boost/parameter/keyword_fwd.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename V, typename R, typename Tag>
|
||||
struct augment_predicate_check_consume_ref
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_scalar<V>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::consume_reference
|
||||
>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_lvalue_reference<R>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, boost::mpl::true_
|
||||
>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename V, typename R, typename Tag>
|
||||
struct augment_predicate_check_out_ref
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_lvalue_reference<R>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_const<V>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/lambda_tag.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Predicate
|
||||
, typename R
|
||||
, typename Tag
|
||||
, typename T
|
||||
, typename Args
|
||||
>
|
||||
class augment_predicate
|
||||
{
|
||||
typedef typename ::boost::mpl::lambda<
|
||||
Predicate
|
||||
, ::boost::parameter::aux::lambda_tag
|
||||
>::type _actual_predicate;
|
||||
|
||||
public:
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate_check_consume_ref<T,R,Tag>
|
||||
, ::boost::parameter::aux
|
||||
::augment_predicate_check_out_ref<T,R,Tag>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
, ::boost::mpl::apply_wrap2<_actual_predicate,T,Args>
|
||||
, ::boost::mpl::false_
|
||||
>::type type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename V, typename R, typename Tag>
|
||||
using augment_predicate_check_consume_ref_mp11 = ::boost::mp11::mp_if<
|
||||
::std::is_scalar<V>
|
||||
, ::boost::mp11::mp_true
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::consume_reference
|
||||
>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_lvalue_reference<R>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, boost::mp11::mp_true
|
||||
>
|
||||
>;
|
||||
|
||||
template <typename V, typename R, typename Tag>
|
||||
using augment_predicate_check_out_ref_mp11 = ::boost::mp11::mp_if<
|
||||
::std::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_lvalue_reference<R>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_const<V>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, ::boost::mp11::mp_false
|
||||
>
|
||||
, ::boost::mp11::mp_true
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mp11/list.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Predicate
|
||||
, typename R
|
||||
, typename Tag
|
||||
, typename T
|
||||
, typename Args
|
||||
>
|
||||
struct augment_predicate_mp11_impl
|
||||
{
|
||||
using type = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_if<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate_check_consume_ref_mp11<T,R,Tag>
|
||||
, ::boost::parameter::aux
|
||||
::augment_predicate_check_out_ref_mp11<T,R,Tag>
|
||||
, ::boost::mp11::mp_false
|
||||
>
|
||||
, ::boost::mp11
|
||||
::mp_apply_q<Predicate,::boost::mp11::mp_list<T,Args> >
|
||||
, ::boost::mp11::mp_false
|
||||
>;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Predicate
|
||||
, typename R
|
||||
, typename Tag
|
||||
, typename T
|
||||
, typename Args
|
||||
>
|
||||
using augment_predicate_mp11 = ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::has_nested_template_fn<Predicate>
|
||||
, ::boost::parameter::aux
|
||||
::augment_predicate_mp11_impl<Predicate,R,Tag,T,Args>
|
||||
, ::boost::parameter::aux
|
||||
::augment_predicate<Predicate,R,Tag,T,Args>
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
111
src/boost/parameter/aux_/default.hpp
Normal file
111
src/boost/parameter/aux_/default.hpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_AUX_DEFAULT_HPP
|
||||
#define BOOST_PARAMETER_AUX_DEFAULT_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A wrapper for the default value passed by the user when resolving
|
||||
// the value of the parameter with the given Keyword
|
||||
template <typename Keyword, typename Value>
|
||||
struct default_
|
||||
{
|
||||
inline BOOST_CONSTEXPR default_(Value& x) : value(x)
|
||||
{
|
||||
}
|
||||
|
||||
Value& value;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// lazy_default -- A wrapper for the default value computation function
|
||||
// passed by the user when resolving the value of the parameter with the
|
||||
// given keyword.
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
|
||||
// These compilers need a little extra help with overload resolution;
|
||||
// we have empty_arg_list's operator[] accept a base class
|
||||
// to make that overload less preferable.
|
||||
template <typename KW, typename DefaultComputer>
|
||||
struct lazy_default_base
|
||||
{
|
||||
inline BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x)
|
||||
: compute_default(x)
|
||||
{
|
||||
}
|
||||
|
||||
DefaultComputer& compute_default;
|
||||
};
|
||||
|
||||
template <typename KW, typename DefaultComputer>
|
||||
struct lazy_default
|
||||
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>
|
||||
{
|
||||
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
|
||||
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>(x)
|
||||
{
|
||||
}
|
||||
};
|
||||
#else // !BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
|
||||
template <typename KW, typename DefaultComputer>
|
||||
struct lazy_default
|
||||
{
|
||||
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
|
||||
: compute_default(x)
|
||||
{
|
||||
}
|
||||
|
||||
DefaultComputer& compute_default;
|
||||
};
|
||||
#endif // EDG workarounds needed.
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
|
||||
#define BOOST_PARAMETER_lazy_default_fallback \
|
||||
::boost::parameter::aux::lazy_default_base
|
||||
/**/
|
||||
#else
|
||||
#define BOOST_PARAMETER_lazy_default_fallback \
|
||||
::boost::parameter::aux::lazy_default
|
||||
/**/
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Value>
|
||||
struct default_r_
|
||||
{
|
||||
inline BOOST_CONSTEXPR default_r_(Value&& x)
|
||||
: value(::std::forward<Value>(x))
|
||||
{
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
|
||||
// MSVC 2015 miscompiles moves for classes containing rvalue ref members
|
||||
// using the default generated move constructor
|
||||
// when moving into a function
|
||||
// https://github.com/boostorg/parameter/pull/109
|
||||
inline BOOST_CONSTEXPR default_r_(default_r_&& x)
|
||||
: value(::std::forward<Value>(x.value))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
Value&& value;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
111
src/boost/parameter/aux_/has_nested_template_fn.hpp
Normal file
111
src/boost/parameter/aux_/has_nested_template_fn.hpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
// Copyright Cromwell D. Enage 2019.
|
||||
// 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 BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
|
||||
#define BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
|
||||
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <template <typename ...> class F>
|
||||
struct has_nested_template_fn_variadic
|
||||
{
|
||||
};
|
||||
#else
|
||||
template <template <typename P0, typename P1> class F>
|
||||
struct has_nested_template_fn_arity_2
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class has_nested_template_fn_impl
|
||||
{
|
||||
template <typename U>
|
||||
static ::boost::parameter::aux::no_tag _check(...);
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename U>
|
||||
static ::boost::parameter::aux::yes_tag
|
||||
_check(
|
||||
::boost::mp11::mp_identity<U> const volatile*
|
||||
, ::boost::parameter::aux::has_nested_template_fn_variadic<
|
||||
U::template fn
|
||||
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
|
||||
);
|
||||
#else
|
||||
template <typename U>
|
||||
static BOOST_CONSTEXPR ::boost::parameter::aux::yes_tag
|
||||
_check(
|
||||
::boost::mpl::identity<U> const volatile*
|
||||
, ::boost::parameter::aux::has_nested_template_fn_arity_2<
|
||||
U::template fn
|
||||
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
|
||||
);
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_bool<
|
||||
#else
|
||||
typedef ::boost::mpl::bool_<
|
||||
#endif
|
||||
sizeof(
|
||||
::boost::parameter::aux::has_nested_template_fn_impl<T>
|
||||
::template _check<T>(
|
||||
static_cast<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_identity<T> const volatile*
|
||||
#else
|
||||
::boost::mpl::identity<T> const volatile*
|
||||
#endif
|
||||
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::yes_tag)
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>;
|
||||
#else
|
||||
> type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using has_nested_template_fn = typename ::boost::parameter::aux
|
||||
::has_nested_template_fn_impl<typename ::std::remove_const<T>::type>
|
||||
::type;
|
||||
#else
|
||||
struct has_nested_template_fn
|
||||
: ::boost::parameter::aux::has_nested_template_fn_impl<
|
||||
typename ::boost::remove_const<T>::type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
52
src/boost/parameter/aux_/is_maybe.hpp
Normal file
52
src/boost/parameter/aux_/is_maybe.hpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2010.
|
||||
// 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 BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct maybe_base
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
using is_maybe = ::std::is_base_of<
|
||||
::boost::parameter::aux::maybe_base
|
||||
, typename ::std::remove_const<T>::type
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_maybe
|
||||
: ::boost::mpl::if_<
|
||||
::boost::is_base_of<
|
||||
::boost::parameter::aux::maybe_base
|
||||
, typename ::boost::remove_const<T>::type
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
64
src/boost/parameter/aux_/is_placeholder.hpp
Normal file
64
src/boost/parameter/aux_/is_placeholder.hpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright Cromwell D. Enage 2019.
|
||||
// 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 BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
|
||||
#define BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_mpl_placeholder
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_false
|
||||
#else
|
||||
: ::boost::mpl::false_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/arg_fwd.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <int I>
|
||||
struct is_mpl_placeholder< ::boost::mpl::arg<I> >
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_true
|
||||
#else
|
||||
: ::boost::mpl::true_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/bind.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_mp11_placeholder : ::boost::mp11::mp_false
|
||||
{
|
||||
};
|
||||
|
||||
template < ::std::size_t I>
|
||||
struct is_mp11_placeholder< ::boost::mp11::mp_arg<I> >
|
||||
: ::boost::mp11::mp_true
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
95
src/boost/parameter/aux_/is_tagged_argument.hpp
Normal file
95
src/boost/parameter/aux_/is_tagged_argument.hpp
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
|
||||
#define BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct tagged_argument_base
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
|
||||
(0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// This metafunction identifies tagged_argument specializations
|
||||
// and their derived classes.
|
||||
template <typename T>
|
||||
struct is_tagged_argument
|
||||
: ::boost::mpl::if_<
|
||||
// Cannot use is_convertible<> to check if T is derived from
|
||||
// tagged_argument_base. -- Cromwell D. Enage
|
||||
::boost::is_base_of<
|
||||
::boost::parameter::aux::tagged_argument_base
|
||||
, typename ::boost::remove_const<
|
||||
typename ::boost::remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // no perfect forwarding support and no exponential overloads
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_tagged_argument_aux
|
||||
: ::boost::is_convertible<
|
||||
T*
|
||||
, ::boost::parameter::aux::tagged_argument_base const*
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// This metafunction identifies tagged_argument specializations
|
||||
// and their derived classes.
|
||||
template <typename T>
|
||||
struct is_tagged_argument
|
||||
: ::boost::mpl::if_<
|
||||
::boost::is_lvalue_reference<T>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::parameter::aux::is_tagged_argument_aux<T>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // perfect forwarding support, or exponential overloads
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
using is_tagged_argument_mp11 = ::std::is_base_of<
|
||||
::boost::parameter::aux::tagged_argument_base
|
||||
, typename ::std::remove_const<
|
||||
typename ::std::remove_reference<T>::type
|
||||
>::type
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
16
src/boost/parameter/aux_/lambda_tag.hpp
Normal file
16
src/boost/parameter/aux_/lambda_tag.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// 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 BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
|
||||
#define BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Tag type passed to MPL lambda.
|
||||
struct lambda_tag;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
32
src/boost/parameter/aux_/pack/as_parameter_requirements.hpp
Normal file
32
src/boost/parameter/aux_/pack/as_parameter_requirements.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
|
||||
|
||||
#include <boost/parameter/aux_/pack/parameter_requirements.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_type.hpp>
|
||||
#include <boost/parameter/aux_/pack/predicate.hpp>
|
||||
#include <boost/parameter/deduced.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Converts a ParameterSpec into a specialization of
|
||||
// parameter_requirements. We need to do this in order to get the
|
||||
// tag_type into the type in a way that can be conveniently matched
|
||||
// by a satisfies(...) member function in arg_list.
|
||||
template <typename ParameterSpec>
|
||||
struct as_parameter_requirements
|
||||
{
|
||||
typedef ::boost::parameter::aux::parameter_requirements<
|
||||
typename ::boost::parameter::aux::tag_type<ParameterSpec>::type
|
||||
, typename ::boost::parameter::aux::predicate<ParameterSpec>::type
|
||||
, ::boost::parameter::aux::has_default<ParameterSpec>
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
217
src/boost/parameter/aux_/pack/deduce_tag.hpp
Normal file
217
src/boost/parameter/aux_/pack/deduce_tag.hpp
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_DEDUCE_TAG_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_DEDUCE_TAG_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Argument
|
||||
, typename ArgumentPack
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct deduce_tag;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/lambda_tag.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Predicate, typename Argument, typename ArgumentPack>
|
||||
struct deduce_tag_condition_mpl
|
||||
: ::boost::mpl::apply_wrap2<
|
||||
typename ::boost::mpl::lambda<
|
||||
Predicate
|
||||
, ::boost::parameter::aux::lambda_tag
|
||||
>::type
|
||||
, Argument
|
||||
, ArgumentPack
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Predicate, typename Argument, typename ArgumentPack>
|
||||
struct deduce_tag_condition_mp11
|
||||
{
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
Predicate
|
||||
, ::boost::mp11::mp_list<Argument,ArgumentPack>
|
||||
>;
|
||||
};
|
||||
|
||||
template <typename Predicate, typename Argument, typename ArgumentPack>
|
||||
using deduce_tag_condition = ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::has_nested_template_fn<Predicate>
|
||||
, ::boost::parameter::aux
|
||||
::deduce_tag_condition_mp11<Predicate,Argument,ArgumentPack>
|
||||
, ::boost::parameter::aux
|
||||
::deduce_tag_condition_mpl<Predicate,Argument,ArgumentPack>
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
#include <boost/parameter/aux_/set.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_type.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_deduced.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Helper for deduce_tag<...>, below.
|
||||
template <
|
||||
typename Argument
|
||||
, typename ArgumentPack
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
class deduce_tag0
|
||||
{
|
||||
typedef typename DeducedArgs::spec _spec;
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::parameter::aux::deduce_tag_condition<
|
||||
typename _spec::predicate
|
||||
#else
|
||||
typedef typename ::boost::mpl::apply_wrap2<
|
||||
typename ::boost::mpl::lambda<
|
||||
typename _spec::predicate
|
||||
, ::boost::parameter::aux::lambda_tag
|
||||
>::type
|
||||
#endif
|
||||
, Argument
|
||||
, ArgumentPack
|
||||
>::type _condition;
|
||||
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
// Deduced parameter matches several arguments.
|
||||
BOOST_MPL_ASSERT((
|
||||
typename ::boost::mpl::eval_if<
|
||||
typename ::boost::parameter::aux::has_key_<
|
||||
UsedArgs
|
||||
, typename ::boost::parameter::aux::tag_type<_spec>::type
|
||||
>::type
|
||||
, ::boost::mpl::eval_if<
|
||||
_condition
|
||||
, ::boost::mpl::if_<
|
||||
EmitsErrors
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
));
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
public:
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = typename ::boost::mp11::mp_if<
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
#endif
|
||||
_condition
|
||||
, ::boost::parameter::aux
|
||||
::tag_deduced<UsedArgs,_spec,Argument,TagFn>
|
||||
, ::boost::parameter::aux::deduce_tag<
|
||||
Argument
|
||||
, ArgumentPack
|
||||
, typename DeducedArgs::tail
|
||||
, UsedArgs
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>::type;
|
||||
#else
|
||||
>::type type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Tries to deduced a keyword tag for a given Argument.
|
||||
// Returns an mpl::pair<> consisting of the tagged_argument<>,
|
||||
// and an mpl::set<> where the new tag has been inserted.
|
||||
//
|
||||
// Argument: The argument type to be tagged.
|
||||
//
|
||||
// ArgumentPack: The ArgumentPack built so far.
|
||||
//
|
||||
// DeducedArgs: A specialization of deduced_item<> (see below).
|
||||
// A list containing only the deduced ParameterSpecs.
|
||||
//
|
||||
// UsedArgs: An mpl::set<> containing the keyword tags used so far.
|
||||
//
|
||||
// TagFn: A metafunction class used to tag positional or deduced
|
||||
// arguments with a keyword tag.
|
||||
template <
|
||||
typename Argument
|
||||
, typename ArgumentPack
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct deduce_tag
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_if<
|
||||
::std::is_same<DeducedArgs,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_identity<
|
||||
::boost::mp11::mp_list< ::boost::parameter::void_,UsedArgs>
|
||||
>
|
||||
#else
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<DeducedArgs,::boost::parameter::void_>
|
||||
, ::boost::mpl::pair< ::boost::parameter::void_,UsedArgs>
|
||||
#endif
|
||||
, ::boost::parameter::aux::deduce_tag0<
|
||||
Argument
|
||||
, ArgumentPack
|
||||
, DeducedArgs
|
||||
, UsedArgs
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
34
src/boost/parameter/aux_/pack/deduced_item.hpp
Normal file
34
src/boost/parameter/aux_/pack/deduced_item.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A typelist that stored deduced parameter specs.
|
||||
template <
|
||||
typename ParameterSpec
|
||||
, typename Tail = ::boost::parameter::void_
|
||||
>
|
||||
struct deduced_item
|
||||
{
|
||||
typedef ParameterSpec spec;
|
||||
typedef Tail tail;
|
||||
};
|
||||
|
||||
// Evaluate Tail and construct deduced_item list.
|
||||
template <typename Spec, typename Tail>
|
||||
struct make_deduced_item
|
||||
{
|
||||
typedef ::boost::parameter::aux
|
||||
::deduced_item<Spec,typename Tail::type> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
23
src/boost/parameter/aux_/pack/insert_tagged.hpp
Normal file
23
src/boost/parameter/aux_/pack/insert_tagged.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
|
||||
|
||||
#include <boost/parameter/aux_/set.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Inserts Tagged::key_type into the UserArgs set.
|
||||
// Extra indirection to lazily evaluate Tagged::key_type.
|
||||
template <typename UsedArgs, typename Tagged>
|
||||
struct insert_tagged
|
||||
: ::boost::parameter::aux::insert_<UsedArgs,typename Tagged::key_type>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
43
src/boost/parameter/aux_/pack/is_named_argument.hpp
Normal file
43
src/boost/parameter/aux_/pack/is_named_argument.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
|
||||
|
||||
#include <boost/parameter/aux_/template_keyword.hpp>
|
||||
#include <boost/parameter/aux_/is_tagged_argument.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using is_named_argument = ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_template_keyword<T>
|
||||
, ::boost::mp11::mp_true
|
||||
, ::boost::parameter::aux::is_tagged_argument_mp11<T>
|
||||
>;
|
||||
#else
|
||||
struct is_named_argument
|
||||
: ::boost::mpl::if_<
|
||||
::boost::parameter::aux::is_template_keyword<T>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::parameter::aux::is_tagged_argument<T>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
47
src/boost/parameter/aux_/pack/item.hpp
Normal file
47
src/boost/parameter/aux_/pack/item.hpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_ITEM_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_ITEM_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A parameter spec item typelist.
|
||||
template <
|
||||
typename Spec
|
||||
, typename Arg
|
||||
, typename Tail = ::boost::parameter::void_
|
||||
>
|
||||
struct item
|
||||
{
|
||||
typedef Spec spec;
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
typedef ::boost::is_const<
|
||||
typename ::boost::remove_reference<Arg>::type
|
||||
> is_arg_const;
|
||||
#endif
|
||||
typedef Arg arg;
|
||||
typedef Tail tail;
|
||||
};
|
||||
|
||||
template <typename Spec, typename Arg, typename Tail>
|
||||
struct make_item
|
||||
{
|
||||
typedef boost::parameter::aux
|
||||
::item<Spec,Arg,typename Tail::type> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
438
src/boost/parameter/aux_/pack/make_arg_list.hpp
Normal file
438
src/boost/parameter/aux_/pack/make_arg_list.hpp
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2018.
|
||||
// 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 BOOST_PARAMETER_AUX_PACK_MAKE_ARG_LIST_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_MAKE_ARG_LIST_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list_aux;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/pack/unmatched_argument.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_type.hpp>
|
||||
#include <boost/parameter/aux_/pack/is_named_argument.hpp>
|
||||
#include <boost/parameter/aux_/pack/insert_tagged.hpp>
|
||||
#include <boost/parameter/aux_/pack/deduce_tag.hpp>
|
||||
#include <boost/parameter/deduced.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename ArgumentPack, typename TaggedArg, typename EmitsErrors>
|
||||
struct append_to_make_arg_list
|
||||
{
|
||||
using type = ::boost::mp11::mp_push_front<
|
||||
ArgumentPack
|
||||
, ::boost::parameter::aux::flat_like_arg_tuple<
|
||||
typename TaggedArg::key_type
|
||||
, TaggedArg
|
||||
, EmitsErrors
|
||||
>
|
||||
>;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Borland needs the insane extra-indirection workaround below so that
|
||||
// it doesn't magically drop the const qualifier from the argument type.
|
||||
template <
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
, typename _argument
|
||||
#endif
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
class make_arg_list00
|
||||
#else
|
||||
class make_arg_list0
|
||||
#endif
|
||||
{
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
typedef typename List::arg _argument;
|
||||
#endif
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _arg_type = typename ::std::remove_const<
|
||||
typename ::std::remove_reference<_argument>::type
|
||||
>::type;
|
||||
using _is_tagged = ::boost::parameter::aux
|
||||
::is_named_argument<_argument>;
|
||||
#else
|
||||
typedef typename ::boost::remove_const<
|
||||
typename ::boost::remove_reference<_argument>::type
|
||||
>::type _arg_type;
|
||||
typedef ::boost::parameter::aux
|
||||
::is_named_argument<_argument> _is_tagged;
|
||||
#endif
|
||||
typedef typename List::spec _parameter_spec;
|
||||
typedef typename ::boost::parameter::aux
|
||||
::tag_type<_parameter_spec>::type _tag;
|
||||
|
||||
// If this argument is either explicitly tagged or a deduced
|
||||
// parameter, then turn off positional matching.
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _is_positional = ::boost::mp11::mp_if<
|
||||
IsPositional
|
||||
, ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_deduced<_parameter_spec>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_if<
|
||||
_is_tagged
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
>
|
||||
, ::boost::mp11::mp_false
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
IsPositional
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_deduced<_parameter_spec>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::if_<
|
||||
_is_tagged
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
>::type _is_positional;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
// If this parameter is explicitly tagged, then add it to the
|
||||
// used-parmeters set. We only really need to add parameters
|
||||
// that are deduced, but we would need a way to check if
|
||||
// a given tag corresponds to a deduced parameter spec.
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _used_args = typename ::boost::mp11::mp_if<
|
||||
_is_tagged
|
||||
, ::boost::parameter::aux::insert_tagged<UsedArgs,_arg_type>
|
||||
, ::boost::mp11::mp_identity<UsedArgs>
|
||||
>::type;
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
_is_tagged
|
||||
, ::boost::parameter::aux::insert_tagged<UsedArgs,_arg_type>
|
||||
, ::boost::mpl::identity<UsedArgs>
|
||||
>::type _used_args;
|
||||
#endif
|
||||
|
||||
// If this parameter is neither explicitly tagged nor positionally
|
||||
// matched, then deduce the tag from the deduced parameter specs.
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _deduced_data = typename ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_if<
|
||||
_is_tagged
|
||||
, ::boost::mp11::mp_true
|
||||
, _is_positional
|
||||
>
|
||||
, ::boost::mp11::mp_identity<
|
||||
::boost::mp11::mp_list< ::boost::parameter::void_,_used_args>
|
||||
>
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
_is_tagged
|
||||
, ::boost::mpl::true_
|
||||
, _is_positional
|
||||
>::type
|
||||
, ::boost::mpl::pair< ::boost::parameter::void_,_used_args>
|
||||
#endif
|
||||
, ::boost::parameter::aux::deduce_tag<
|
||||
_argument
|
||||
, ArgumentPack
|
||||
, DeducedArgs
|
||||
, _used_args
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>::type;
|
||||
#else
|
||||
>::type _deduced_data;
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
// If this parameter is explicitly tagged ...
|
||||
using _tagged = ::boost::mp11::mp_if<
|
||||
_is_tagged
|
||||
// ... just use it
|
||||
, _arg_type
|
||||
// ... else ...
|
||||
, ::boost::mp11::mp_if<
|
||||
// if positional matching is turned on ...
|
||||
_is_positional
|
||||
// ... tag it positionally
|
||||
, ::boost::mp11::mp_apply_q<
|
||||
TagFn
|
||||
, ::boost::mp11::mp_list<_tag,_argument>
|
||||
>
|
||||
// ... else, use the deduced tag
|
||||
, ::boost::mp11::mp_at_c<_deduced_data,0>
|
||||
>
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
// If this parameter is explicitly tagged ...
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
_is_tagged
|
||||
// ... just use it
|
||||
, ::boost::mpl::identity<_arg_type>
|
||||
// ... else ...
|
||||
, ::boost::mpl::eval_if<
|
||||
// if positional matching is turned on ...
|
||||
_is_positional
|
||||
// ... tag it positionally
|
||||
, ::boost::mpl::apply_wrap2<TagFn,_tag,_argument>
|
||||
// ... else, use the deduced tag
|
||||
, ::boost::mpl::first<_deduced_data>
|
||||
>
|
||||
>::type _tagged;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
// Build the arg_list incrementally, prepending new nodes.
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _error = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<Error,::boost::parameter::void_>
|
||||
, ::std::is_same<_tagged,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_false
|
||||
>
|
||||
#else
|
||||
typedef typename ::boost::mpl::if_<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<Error,::boost::parameter::void_>
|
||||
, ::boost::is_same<_tagged,::boost::parameter::void_>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
#endif
|
||||
, ::boost::parameter::aux::unmatched_argument<_argument>
|
||||
, ::boost::parameter::void_
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>;
|
||||
#else
|
||||
>::type _error;
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using _argument_pack = typename ::boost::mp11::mp_if<
|
||||
::std::is_same<_tagged,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_identity<ArgumentPack>
|
||||
, ::boost::parameter::aux
|
||||
::append_to_make_arg_list<ArgumentPack,_tagged,EmitsErrors>
|
||||
>::type;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_same<_tagged,::boost::parameter::void_>
|
||||
, ArgumentPack
|
||||
#if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
, ::boost::parameter::aux::arg_list<_tagged,ArgumentPack>
|
||||
#else
|
||||
, ::boost::parameter::aux
|
||||
::arg_list<_tagged,ArgumentPack,EmitsErrors>
|
||||
#endif
|
||||
>::type _argument_pack;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
public:
|
||||
typedef typename ::boost::parameter::aux::make_arg_list_aux<
|
||||
typename List::tail
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, _is_positional
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::mp11::mp_at_c<_deduced_data,1>
|
||||
#else
|
||||
, typename _deduced_data::second
|
||||
#endif
|
||||
, _argument_pack
|
||||
, _error
|
||||
, EmitsErrors
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
template <
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list0
|
||||
{
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename List::is_arg_const
|
||||
, ::boost::parameter::aux::make_arg_list00<
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, IsPositional
|
||||
, UsedArgs
|
||||
, ArgumentPack
|
||||
, typename List::arg const
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
, ::boost::parameter::aux::make_arg_list00<
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, IsPositional
|
||||
, UsedArgs
|
||||
, ArgumentPack
|
||||
, typename List::arg
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
// Returns an ArgumentPack where the list of arguments has been tagged
|
||||
// with keyword tags.
|
||||
//
|
||||
// List: A specialization of item<> (see below). Contains both
|
||||
// the ordered ParameterSpecs, and the given arguments.
|
||||
//
|
||||
// DeducedArgs: A specialization of deduced_item<> (see below).
|
||||
// A list containing only the deduced ParameterSpecs.
|
||||
//
|
||||
// TagFn: A metafunction class used to tag positional or deduced
|
||||
// arguments with a keyword tag.
|
||||
//
|
||||
// IsPositional: An mpl::bool_<> specialization indicating if positional
|
||||
// matching is to be performed.
|
||||
//
|
||||
// DeducedSet: An mpl::set<> containing the keyword tags used so far.
|
||||
//
|
||||
// ArgumentPack: The ArgumentPack built so far. This is initially an
|
||||
// empty_arg_list and is built incrementally.
|
||||
template <
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename IsPositional
|
||||
, typename DeducedSet
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list_aux
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_if<
|
||||
::std::is_same<List,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_identity<
|
||||
::boost::mp11::mp_list<ArgumentPack,Error>
|
||||
>
|
||||
#else
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<List,::boost::parameter::void_>
|
||||
, ::boost::mpl::identity< ::boost::mpl::pair<ArgumentPack,Error> >
|
||||
#endif
|
||||
, ::boost::parameter::aux::make_arg_list0<
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, IsPositional
|
||||
, DeducedSet
|
||||
, ArgumentPack
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/set.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// VC6.5 was choking on the default parameters for make_arg_list_aux,
|
||||
// so this just forwards to that adding in the defaults.
|
||||
template <
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, typename EmitsErrors = ::boost::mp11::mp_true
|
||||
#else
|
||||
, typename EmitsErrors = ::boost::mpl::true_
|
||||
#endif
|
||||
>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using make_arg_list = ::boost::parameter::aux::make_arg_list_aux<
|
||||
#else
|
||||
struct make_arg_list
|
||||
: ::boost::parameter::aux::make_arg_list_aux<
|
||||
#endif
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::mp11::mp_true
|
||||
#else
|
||||
, ::boost::mpl::true_
|
||||
#endif
|
||||
, ::boost::parameter::aux::set0
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::parameter::aux::flat_like_arg_list<>
|
||||
#else
|
||||
, ::boost::parameter::aux::empty_arg_list
|
||||
#endif
|
||||
, ::boost::parameter::void_
|
||||
, EmitsErrors
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>;
|
||||
#else
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
53
src/boost/parameter/aux_/pack/make_deduced_items.hpp
Normal file
53
src/boost/parameter/aux_/pack/make_deduced_items.hpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/pack/deduced_item.hpp>
|
||||
#include <boost/parameter/deduced.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Spec, typename Tail>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using make_deduced_items = ::boost::mp11::mp_if<
|
||||
::std::is_same<Spec,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_deduced<Spec>
|
||||
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
|
||||
, Tail
|
||||
>
|
||||
>;
|
||||
#else
|
||||
struct make_deduced_items
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<Spec,::boost::parameter::void_>
|
||||
, ::boost::mpl::identity< ::boost::parameter::void_>
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_deduced<Spec>
|
||||
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
|
||||
, Tail
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
45
src/boost/parameter/aux_/pack/make_items.hpp
Normal file
45
src/boost/parameter/aux_/pack/make_items.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/pack/item.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Creates a item typelist.
|
||||
template <typename Spec, typename Arg, typename Tail>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using make_items = ::boost::mp11::mp_if<
|
||||
::std::is_same<Arg,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
|
||||
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
|
||||
>;
|
||||
#else
|
||||
struct make_items
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<Arg,::boost::parameter::void_>
|
||||
, ::boost::mpl::identity< ::boost::parameter::void_>
|
||||
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
244
src/boost/parameter/aux_/pack/make_parameter_spec_items.hpp
Normal file
244
src/boost/parameter/aux_/pack/make_parameter_spec_items.hpp
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_AUX_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// This recursive metafunction forwards successive elements of
|
||||
// parameters::parameter_spec to make_deduced_items<>.
|
||||
// -- Cromwell D. Enage
|
||||
template <typename SpecSeq>
|
||||
struct make_deduced_list;
|
||||
|
||||
// Helper for match_parameters_base_cond<...>, below.
|
||||
template <typename ArgumentPackAndError, typename SpecSeq>
|
||||
struct match_parameters_base_cond_helper;
|
||||
|
||||
// Helper metafunction for make_parameter_spec_items<...>, below.
|
||||
template <typename SpecSeq, typename ...Args>
|
||||
struct make_parameter_spec_items_helper;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename SpecSeq>
|
||||
struct make_parameter_spec_items_helper<SpecSeq>
|
||||
{
|
||||
typedef ::boost::parameter::void_ type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/pack/make_deduced_items.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/list.hpp>
|
||||
#else
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/pop_front.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename SpecSeq>
|
||||
struct make_deduced_list_not_empty
|
||||
: ::boost::parameter::aux::make_deduced_items<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_front<SpecSeq>
|
||||
#else
|
||||
typename ::boost::mpl::front<SpecSeq>::type
|
||||
#endif
|
||||
, ::boost::parameter::aux::make_deduced_list<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_pop_front<SpecSeq>
|
||||
#else
|
||||
typename ::boost::mpl::pop_front<SpecSeq>::type
|
||||
#endif
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/empty.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename SpecSeq>
|
||||
struct make_deduced_list
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_empty<SpecSeq>
|
||||
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
|
||||
#else
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::mpl::empty<SpecSeq>
|
||||
, ::boost::mpl::identity< ::boost::parameter::void_>
|
||||
#endif
|
||||
, ::boost::parameter::aux::make_deduced_list_not_empty<SpecSeq>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename ArgumentPackAndError>
|
||||
struct is_arg_pack_error_void
|
||||
: ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
typename ::boost::mpl::second<ArgumentPackAndError>::type
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Checks if the arguments match the criteria of overload resolution.
|
||||
// If NamedList satisfies the PS0, PS1, ..., this is a metafunction
|
||||
// returning parameters. Otherwise it has no nested ::type.
|
||||
template <typename ArgumentPackAndError, typename SpecSeq>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using match_parameters_base_cond = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_empty<SpecSeq>
|
||||
, ::std::is_same<
|
||||
::boost::mp11::mp_at_c<ArgumentPackAndError,1>
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
, ::boost::parameter::aux::match_parameters_base_cond_helper<
|
||||
ArgumentPackAndError
|
||||
, SpecSeq
|
||||
>
|
||||
>;
|
||||
#else
|
||||
struct match_parameters_base_cond
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::mpl::empty<SpecSeq>
|
||||
, ::boost::parameter::aux
|
||||
::is_arg_pack_error_void<ArgumentPackAndError>
|
||||
, ::boost::parameter::aux::match_parameters_base_cond_helper<
|
||||
ArgumentPackAndError
|
||||
, SpecSeq
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/pack/satisfies.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename ArgumentPackAndError, typename SpecSeq>
|
||||
struct match_parameters_base_cond_helper
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_if<
|
||||
#else
|
||||
: ::boost::mpl::eval_if<
|
||||
#endif
|
||||
::boost::parameter::aux::satisfies_requirements_of<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_at_c<ArgumentPackAndError,0>
|
||||
, ::boost::mp11::mp_front<SpecSeq>
|
||||
#else
|
||||
typename ::boost::mpl::first<ArgumentPackAndError>::type
|
||||
, typename ::boost::mpl::front<SpecSeq>::type
|
||||
#endif
|
||||
>
|
||||
, ::boost::parameter::aux::match_parameters_base_cond<
|
||||
ArgumentPackAndError
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::mp11::mp_pop_front<SpecSeq>
|
||||
#else
|
||||
, typename ::boost::mpl::pop_front<SpecSeq>::type
|
||||
#endif
|
||||
>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::mp11::mp_false
|
||||
#else
|
||||
, ::boost::mpl::false_
|
||||
#endif
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// This parameters item chaining metafunction class does not require
|
||||
// the lengths of the SpecSeq and of Args parameter pack to match.
|
||||
// Used by argument_pack to build the items in the resulting arg_list.
|
||||
// -- Cromwell D. Enage
|
||||
template <typename SpecSeq, typename ...Args>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using make_parameter_spec_items = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_empty<SpecSeq>
|
||||
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
|
||||
, ::boost::parameter::aux
|
||||
::make_parameter_spec_items_helper<SpecSeq,Args...>
|
||||
>;
|
||||
#else
|
||||
struct make_parameter_spec_items
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::mpl::empty<SpecSeq>
|
||||
, ::boost::mpl::identity< ::boost::parameter::void_>
|
||||
, ::boost::parameter::aux
|
||||
::make_parameter_spec_items_helper<SpecSeq,Args...>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/pack/make_items.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename SpecSeq, typename A0, typename ...Args>
|
||||
struct make_parameter_spec_items_helper<SpecSeq,A0,Args...>
|
||||
: ::boost::parameter::aux::make_items<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_front<SpecSeq>
|
||||
#else
|
||||
typename ::boost::mpl::front<SpecSeq>::type
|
||||
#endif
|
||||
, A0
|
||||
, ::boost::parameter::aux::make_parameter_spec_items<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_pop_front<SpecSeq>
|
||||
#else
|
||||
typename ::boost::mpl::pop_front<SpecSeq>::type
|
||||
#endif
|
||||
, Args...
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
25
src/boost/parameter/aux_/pack/parameter_requirements.hpp
Normal file
25
src/boost/parameter/aux_/pack/parameter_requirements.hpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Used to pass static information about parameter requirements through
|
||||
// the satisfies() overload set (below). The matched function is never
|
||||
// invoked, but its type indicates whether a parameter matches at
|
||||
// compile-time.
|
||||
template <typename Keyword, typename Predicate, typename HasDefault>
|
||||
struct parameter_requirements
|
||||
{
|
||||
typedef Keyword keyword;
|
||||
typedef Predicate predicate;
|
||||
typedef HasDefault has_default;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
87
src/boost/parameter/aux_/pack/predicate.hpp
Normal file
87
src/boost/parameter/aux_/pack/predicate.hpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
|
||||
#define 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 <boost/parameter/aux_/use_default.hpp>
|
||||
#include <boost/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 <boost/parameter/required.hpp>
|
||||
#include <boost/parameter/optional.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
#if defined(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 // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
142
src/boost/parameter/aux_/pack/satisfies.hpp
Normal file
142
src/boost/parameter/aux_/pack/satisfies.hpp
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/augment_predicate.hpp>
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
|
||||
#endif // MSVC-7.1 workarounds needed
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
template <typename ArgList, typename ParameterRequirements, typename Bound>
|
||||
struct satisfies_impl
|
||||
: ::boost::parameter::aux::augment_predicate<
|
||||
typename ParameterRequirements::predicate
|
||||
, typename ArgList::reference
|
||||
, typename ArgList::key_type
|
||||
, Bound
|
||||
, ArgList
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
// Returns mpl::true_ iff the given ParameterRequirements are satisfied by
|
||||
// ArgList.
|
||||
template <typename ArgList, typename ParameterRequirements>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using satisfies = ::boost::mp11::mp_bool<
|
||||
sizeof(
|
||||
::boost::parameter::aux::to_yesno(
|
||||
ArgList::satisfies(
|
||||
static_cast<ParameterRequirements*>(
|
||||
BOOST_PARAMETER_AUX_PP_NULLPTR
|
||||
)
|
||||
, static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
|
||||
)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::yes_tag)
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
class satisfies
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
// VC7.1 can't handle the sizeof() implementation below,
|
||||
// so we use this instead.
|
||||
typedef typename ::boost::mpl::apply_wrap3<
|
||||
typename ArgList::binding
|
||||
, typename ParameterRequirements::keyword
|
||||
, ::boost::parameter::void_
|
||||
, ::boost::mpl::false_
|
||||
>::type _bound;
|
||||
|
||||
public:
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<_bound,::boost::parameter::void_>
|
||||
, typename ParameterRequirements::has_default
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
ArgList
|
||||
, ::boost::parameter::aux::empty_arg_list
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::parameter::aux::satisfies_impl<
|
||||
ArgList
|
||||
, ParameterRequirements
|
||||
, _bound
|
||||
>
|
||||
>
|
||||
>::type type;
|
||||
#else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, _value = (
|
||||
sizeof(
|
||||
::boost::parameter::aux::to_yesno(
|
||||
ArgList::satisfies(
|
||||
static_cast<ParameterRequirements*>(
|
||||
BOOST_PARAMETER_AUX_PP_NULLPTR
|
||||
)
|
||||
, static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
|
||||
)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::yes_tag)
|
||||
)
|
||||
);
|
||||
|
||||
public:
|
||||
typedef ::boost::mpl::bool_<
|
||||
::boost::parameter::aux
|
||||
::satisfies<ArgList,ParameterRequirements>::_value
|
||||
> type;
|
||||
#endif // MSVC-7.1 workarounds needed
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/pack/as_parameter_requirements.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Returns mpl::true_ if the requirements of the given ParameterSpec
|
||||
// are satisfied by ArgList.
|
||||
template <typename ArgList, typename ParameterSpec>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using satisfies_requirements_of = ::boost::parameter::aux::satisfies<
|
||||
ArgList
|
||||
, typename ::boost::parameter::aux
|
||||
::as_parameter_requirements<ParameterSpec>::type
|
||||
>;
|
||||
#else
|
||||
struct satisfies_requirements_of
|
||||
: ::boost::parameter::aux::satisfies<
|
||||
ArgList
|
||||
, typename ::boost::parameter::aux
|
||||
::as_parameter_requirements<ParameterSpec>::type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
59
src/boost/parameter/aux_/pack/tag_deduced.hpp
Normal file
59
src/boost/parameter/aux_/pack/tag_deduced.hpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
|
||||
|
||||
#include <boost/parameter/aux_/set.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_type.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Tags a deduced argument Arg with the keyword tag of Spec using TagFn.
|
||||
// Returns the tagged argument and the mpl::set<> UsedArgs with the
|
||||
// tag of Spec inserted.
|
||||
template <typename UsedArgs, typename Spec, typename Arg, typename TagFn>
|
||||
struct tag_deduced
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_list<
|
||||
::boost::mp11::mp_apply_q<
|
||||
TagFn
|
||||
, ::boost::mp11::mp_list<
|
||||
typename ::boost::parameter::aux::tag_type<Spec>::type
|
||||
, Arg
|
||||
>
|
||||
>
|
||||
#else
|
||||
typedef ::boost::mpl::pair<
|
||||
typename ::boost::mpl::apply_wrap2<
|
||||
TagFn
|
||||
, typename ::boost::parameter::aux::tag_type<Spec>::type
|
||||
, Arg
|
||||
>::type
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
, typename ::boost::parameter::aux::insert_<
|
||||
UsedArgs
|
||||
, typename ::boost::parameter::aux::tag_type<Spec>::type
|
||||
>::type
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>;
|
||||
#else
|
||||
> type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
30
src/boost/parameter/aux_/pack/tag_keyword_arg.hpp
Normal file
30
src/boost/parameter/aux_/pack/tag_keyword_arg.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
|
||||
|
||||
#include <boost/parameter/aux_/tag.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct tag_keyword_arg
|
||||
{
|
||||
template <typename K, typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::tag<K,T>::type type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename K, typename T>
|
||||
using fn = typename ::boost::parameter::aux::tag<K,T>::type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
67
src/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Normal file
67
src/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
|
||||
|
||||
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
|
||||
#include <boost/parameter/aux_/tagged_argument.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Keyword
|
||||
, typename ActualArg
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
, typename = typename ::boost::parameter::aux
|
||||
::is_cv_reference_wrapper<ActualArg>::type
|
||||
#endif
|
||||
>
|
||||
struct tag_ref
|
||||
{
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux
|
||||
::unwrap_cv_reference<ActualArg>::type
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename ActualArg>
|
||||
struct tag_ref<Keyword,ActualArg,::boost::mpl::false_>
|
||||
{
|
||||
typedef ::boost::parameter::aux
|
||||
::tagged_argument<Keyword,ActualArg> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct tag_keyword_arg_ref
|
||||
{
|
||||
template <typename K, typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::tag_ref<K,T>::type type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename K, typename T>
|
||||
using fn = typename ::boost::parameter::aux::tag_ref<K,T>::type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
30
src/boost/parameter/aux_/pack/tag_template_keyword_arg.hpp
Normal file
30
src/boost/parameter/aux_/pack/tag_template_keyword_arg.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
|
||||
|
||||
#include <boost/parameter/template_keyword.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct tag_template_keyword_arg
|
||||
{
|
||||
template <typename K, typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef ::boost::parameter::template_keyword<K,T> type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename K, typename T>
|
||||
using fn = ::boost::parameter::template_keyword<K,T>;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
89
src/boost/parameter/aux_/pack/tag_type.hpp
Normal file
89
src/boost/parameter/aux_/pack/tag_type.hpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// helper for tag_type<...>, below.
|
||||
template <typename T>
|
||||
struct get_tag_type0
|
||||
{
|
||||
typedef typename T::key_type type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/deduced.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct get_tag_type
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_if<
|
||||
#else
|
||||
: ::boost::mpl::eval_if<
|
||||
#endif
|
||||
::boost::parameter::aux::is_deduced0<T>
|
||||
, ::boost::parameter::aux::get_tag_type0<typename T::key_type>
|
||||
, ::boost::parameter::aux::get_tag_type0<T>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/required.hpp>
|
||||
#include <boost/parameter/optional.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
using tag_type = ::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_tag_type<T>
|
||||
, ::boost::mp11::mp_identity<T>
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct tag_type
|
||||
: ::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_tag_type<T>
|
||||
, ::boost::mpl::identity<T>
|
||||
>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
41
src/boost/parameter/aux_/pack/unmatched_argument.hpp
Normal file
41
src/boost/parameter/aux_/pack/unmatched_argument.hpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// 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 BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
|
||||
#define BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct unmatched_argument
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
static_assert(::std::is_same<T,void>::value, "T == void");
|
||||
#else
|
||||
BOOST_MPL_ASSERT((
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<T,void>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
));
|
||||
#endif
|
||||
typedef int type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
12
src/boost/parameter/aux_/parameter_requirements.hpp
Normal file
12
src/boost/parameter/aux_/parameter_requirements.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_AUX_PARAMETER_REQUIREMENTS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PARAMETER_REQUIREMENTS_HPP
|
||||
|
||||
#include <boost/parameter/aux_/pack/parameter_requirements.hpp>
|
||||
|
||||
#endif // include guard
|
||||
|
||||
1638
src/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Normal file
1638
src/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Normal file
File diff suppressed because it is too large
Load diff
1796
src/boost/parameter/aux_/preprocessor/binary_seq_for_each_inc.hpp
Normal file
1796
src/boost/parameter/aux_/preprocessor/binary_seq_for_each_inc.hpp
Normal file
File diff suppressed because it is too large
Load diff
65
src/boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp
Normal file
65
src/boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n) const&
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n)&
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_2(n, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_2(n, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_ \
|
||||
, BOOST_PP_SEQ_SIZE(prefix_seq) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_ \
|
||||
, BOOST_PP_SEQ_SIZE(prefix_seq) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/convert_binary_seq.hpp>
|
||||
|
||||
// This macro converts the specified Boost.Preprocessor sequence of 1s and 0s
|
||||
// into a formal function parameter list.
|
||||
//
|
||||
// Example:
|
||||
// BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS((1)(0)(1)(0), (P)(p))
|
||||
// expands to
|
||||
// P0 & p0, P1 const& p1, P2 & p2, P3 const& p3
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS(binary_seq, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ( \
|
||||
binary_seq \
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
|
||||
, prefix_seq \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
57
src/boost/parameter/aux_/preprocessor/convert_binary_seq.hpp
Normal file
57
src/boost/parameter/aux_/preprocessor/convert_binary_seq.hpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// Copyright Cromwell D. Enage 2013.
|
||||
// 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 BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/seq/push_back.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP(s, seq, idx) \
|
||||
BOOST_PP_SEQ_PUSH_BACK(seq, (idx, BOOST_PP_SEQ_SIZE(seq)))
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP(s, seq, elem) \
|
||||
( \
|
||||
BOOST_PP_SEQ_PUSH_BACK( \
|
||||
BOOST_PP_SEQ_ELEM(0, seq) \
|
||||
, BOOST_PP_IIF( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, elem) \
|
||||
, BOOST_PP_SEQ_ELEM(2, seq) \
|
||||
, BOOST_PP_SEQ_ELEM(1, seq) \
|
||||
)(BOOST_PP_TUPLE_ELEM(2, 1, elem), BOOST_PP_SEQ_ELEM(3, seq)) \
|
||||
) \
|
||||
)(BOOST_PP_SEQ_ELEM(1, seq))(BOOST_PP_SEQ_ELEM(2, seq)) \
|
||||
(BOOST_PP_SEQ_ELEM(3, seq))
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/seq/fold_left.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ(seq, macro0, macro1, data) \
|
||||
BOOST_PARAMETER_SEQ_ENUM( \
|
||||
BOOST_PP_SEQ_ELEM( \
|
||||
0 \
|
||||
, BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP \
|
||||
, (BOOST_PP_SEQ_NIL)(macro0)(macro1)(data) \
|
||||
, BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP \
|
||||
, BOOST_PP_EMPTY() \
|
||||
, seq \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
1029
src/boost/parameter/aux_/preprocessor/for_each_pred.hpp
Normal file
1029
src/boost/parameter/aux_/preprocessor/for_each_pred.hpp
Normal file
File diff suppressed because it is too large
Load diff
78
src/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Normal file
78
src/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// Copyright Cromwell D. Enage 2013.
|
||||
// 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 BOOST_PARAMETER_AUX_PREPROCESSOR_INC_BINARY_SEQ_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_INC_BINARY_SEQ_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/push_back.hpp>
|
||||
|
||||
// This macro keeps the rest of the sequence if carry == 0.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_0(seq, element) \
|
||||
(BOOST_PP_SEQ_PUSH_BACK(seq, element), 0)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
// This macro updates the rest of the sequence if carry == 1.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_1(seq, element) \
|
||||
(BOOST_PP_SEQ_PUSH_BACK(seq, BOOST_PP_IIF(element, 0, 1)), element)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
// This macro maintains a tuple (seq, carry), where seq is the intermediate
|
||||
// result and carry is a flag that will unset upon finding an element == 0.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_OP(s, result_tuple, element) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_ \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, result_tuple) \
|
||||
)(BOOST_PP_TUPLE_ELEM(2, 0, result_tuple), element)
|
||||
/**/
|
||||
|
||||
// This macro keeps the sequence at its original length if carry == 0.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_0(seq) seq
|
||||
/**/
|
||||
|
||||
// This macro appends a zero to seq if carry == 1.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_1(seq) \
|
||||
BOOST_PP_SEQ_PUSH_BACK(seq, 0)
|
||||
/**/
|
||||
|
||||
// This macro takes in the tuple (seq, carry), with carry indicating whether
|
||||
// or not seq originally contained all 1s. If so, then seq now contains all
|
||||
// 0s, and this macro pushes an extra 0 before expanding to the new sequence.
|
||||
// Otherwise, this macro expands to seq as is.
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL(seq_and_carry) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_ \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, seq_and_carry) \
|
||||
)(BOOST_PP_TUPLE_ELEM(2, 0, seq_and_carry))
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/seq/fold_left.hpp>
|
||||
|
||||
// This macro treats the specified sequence of 1s and 0s like a binary number
|
||||
// in reverse and expands to a sequence representing the next value up.
|
||||
// However, if the input sequence contains all 1s, then the output sequence
|
||||
// will contain one more element but all 0s.
|
||||
//
|
||||
// Examples:
|
||||
// seq = (1)(0)(1)(0) --> return (0)(1)(1)(0)
|
||||
// seq = (1)(1)(1)(0) --> return (0)(0)(0)(1)
|
||||
// seq = (1)(1)(1)(1) --> return (0)(0)(0)(0)(0)
|
||||
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ(seq) \
|
||||
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL( \
|
||||
BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_OP \
|
||||
, (BOOST_PP_SEQ_NIL, 1) \
|
||||
, seq \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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)
|
||||
|
||||
// No include guard. This file is intended for multiple inclusion.
|
||||
|
||||
#define BOOST_PARAMETER_right_angle(z, n, _) >
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_satisfies_end(z, n, false_t) ,false_t>
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
// Generates:
|
||||
//
|
||||
// make<
|
||||
// parameter_spec##0, argument_type##0
|
||||
// , make<
|
||||
// parameter_spec##1, argument_type##1
|
||||
// , ... boost::mpl::identity<boost::parameter::aux::empty_arg_list>
|
||||
// ...>
|
||||
// >
|
||||
#define BOOST_PARAMETER_make_arg_list(z, n, names) \
|
||||
BOOST_PP_SEQ_ELEM(0, names)< \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n), \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(2, names), n),
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_build_arg_list(n, make, param_spec, arg_type) \
|
||||
BOOST_PP_REPEAT( \
|
||||
n, BOOST_PARAMETER_make_arg_list, (make)(param_spec)(arg_type) \
|
||||
) \
|
||||
::boost::mpl::identity< ::boost::parameter::void_> \
|
||||
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_make_deduced_list(z, n, names) \
|
||||
BOOST_PP_SEQ_ELEM(0, names)<BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n),
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_build_deduced_list(n, make, parameter_spec) \
|
||||
BOOST_PP_REPEAT( \
|
||||
n, BOOST_PARAMETER_make_deduced_list, (make)(parameter_spec) \
|
||||
) \
|
||||
::boost::mpl::identity< ::boost::parameter::void_> \
|
||||
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_forward_typedef(z, n, names) \
|
||||
typedef BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, names), n) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n);
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_template_args(z, n, prefix) \
|
||||
typename BOOST_PP_CAT(prefix, n) = ::boost::parameter::void_
|
||||
/**/
|
||||
|
||||
#include <boost/mpl/pair.hpp>
|
||||
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
|
||||
#include <boost/parameter/aux_/pack/item.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_make_arg_items_R(r, prefix, i, elem) \
|
||||
::boost::parameter::aux::item<BOOST_PP_CAT(prefix, i), \
|
||||
BOOST_PP_CAT(A, i) BOOST_PP_IIF(elem, &, const&),
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_arg_list_R(r, seq) \
|
||||
::boost::parameter::aux::make_arg_list< \
|
||||
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
||||
r, BOOST_PARAMETER_make_arg_items_R, PS, seq \
|
||||
) \
|
||||
::boost::parameter::void_ \
|
||||
BOOST_PP_REPEAT( \
|
||||
BOOST_PP_SEQ_SIZE(seq), BOOST_PARAMETER_right_angle, _ \
|
||||
) \
|
||||
, deduced_list \
|
||||
, ::boost::parameter::aux::tag_keyword_arg \
|
||||
>
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_arg_pack_init(z, n, limit) \
|
||||
BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_op_overload_R(r, seq) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
|
||||
, typename A \
|
||||
) \
|
||||
> \
|
||||
inline typename ::boost::mpl::first< \
|
||||
typename BOOST_PARAMETER_function_call_arg_list_R( \
|
||||
r, BOOST_PP_SEQ_TAIL(seq) \
|
||||
)::type \
|
||||
>::type \
|
||||
operator()( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
|
||||
BOOST_PP_SEQ_TAIL(seq), (A)(a) \
|
||||
) \
|
||||
) const \
|
||||
{ \
|
||||
typedef typename BOOST_PARAMETER_function_call_arg_list_R( \
|
||||
r, BOOST_PP_SEQ_TAIL(seq) \
|
||||
)::type result; \
|
||||
typedef typename ::boost::mpl::first<result>::type result_type; \
|
||||
typedef typename ::boost::mpl::second<result>::type error; \
|
||||
error(); \
|
||||
return result_type( \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
|
||||
, BOOST_PARAMETER_function_call_arg_pack_init \
|
||||
, BOOST_PP_DEC(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq))) \
|
||||
) \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS( \
|
||||
BOOST_PP_SUB( \
|
||||
BOOST_PARAMETER_COMPOSE_MAX_ARITY \
|
||||
, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
|
||||
) \
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
|
||||
) \
|
||||
); \
|
||||
}
|
||||
/**/
|
||||
|
||||
#endif // exponential overloads
|
||||
|
||||
#include <boost/parameter/aux_/pack/satisfies.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_satisfies_begin(z, n, prefix) \
|
||||
::boost::mpl::eval_if< \
|
||||
::boost::parameter::aux::satisfies_requirements_of< \
|
||||
typename ::boost::mpl::first<ArgumentPackAndError>::type \
|
||||
, BOOST_PP_CAT(prefix, n) \
|
||||
>,
|
||||
/**/
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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)
|
||||
|
||||
// No include guard. This file is intended for multiple inclusion.
|
||||
|
||||
#undef BOOST_PARAMETER_satisfies_begin
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#undef BOOST_PARAMETER_function_call_op_overload_R
|
||||
#undef BOOST_PARAMETER_function_call_arg_pack_init
|
||||
#undef BOOST_PARAMETER_function_call_arg_list_R
|
||||
#undef BOOST_PARAMETER_make_arg_items_R
|
||||
#endif
|
||||
#undef BOOST_PARAMETER_template_args
|
||||
#undef BOOST_PARAMETER_forward_typedef
|
||||
#undef BOOST_PARAMETER_build_deduced_list
|
||||
#undef BOOST_PARAMETER_make_deduced_list
|
||||
#undef BOOST_PARAMETER_build_arg_list
|
||||
#undef BOOST_PARAMETER_make_arg_list
|
||||
#undef BOOST_PARAMETER_satisfies_end
|
||||
#undef BOOST_PARAMETER_right_angle
|
||||
|
||||
18
src/boost/parameter/aux_/preprocessor/nullptr.hpp
Normal file
18
src/boost/parameter/aux_/preprocessor/nullptr.hpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright Cromwell D. Enage 2019.
|
||||
// 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 BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_NULLPTR)
|
||||
#define BOOST_PARAMETER_AUX_PP_NULLPTR 0
|
||||
#else
|
||||
#define BOOST_PARAMETER_AUX_PP_NULLPTR nullptr
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
||||
92
src/boost/parameter/aux_/preprocessor/overloads.hpp
Normal file
92
src/boost/parameter/aux_/preprocessor/overloads.hpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// 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)
|
||||
|
||||
// This file generates overloads in this format:
|
||||
//
|
||||
// template <typename A0, typename A1>
|
||||
// typename ::boost::mpl::apply_wrap1<
|
||||
// ::boost::parameter::aux::make_arg_list<
|
||||
// PS0,A0
|
||||
// , ::boost::parameter::aux::make_arg_list<
|
||||
// PS1,A1
|
||||
// , ::boost::mpl::identity<
|
||||
// ::boost::parameter::aux::empty_arg_list
|
||||
// >
|
||||
// >
|
||||
// >
|
||||
// , unnamed_list
|
||||
// >::type
|
||||
// operator()(A0 const& a0, A1 const& a1) const
|
||||
// {
|
||||
// typedef typename ::boost::mpl::apply_wrap1<
|
||||
// ::boost::parameter::aux::make_arg_list<
|
||||
// PS0,A0
|
||||
// , ::boost::parameter::aux::make_arg_list<
|
||||
// PS1,A1
|
||||
// , ::boost::mpl::identity<
|
||||
// ::boost::parameter::aux::empty_arg_list
|
||||
// >
|
||||
// >
|
||||
// >
|
||||
// >::type arg_tuple;
|
||||
//
|
||||
// return arg_tuple(
|
||||
// a0
|
||||
// , a1
|
||||
// , ::boost::parameter::aux::void_()
|
||||
// ...
|
||||
// );
|
||||
// }
|
||||
//
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Parameters - do not include this file!
|
||||
#endif
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#define BOOST_PARAMETER_open_list(z, n, text) \
|
||||
::boost::parameter::aux::item< \
|
||||
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
|
||||
|
||||
#define BOOST_PARAMETER_close_list(z, n, text) >
|
||||
|
||||
#define BOOST_PARAMETER_arg_list(n) \
|
||||
::boost::parameter::aux::make_arg_list< \
|
||||
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
|
||||
, ::boost::parameter::void_ \
|
||||
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
|
||||
, deduced_list \
|
||||
, ::boost::parameter::aux::tag_keyword_arg \
|
||||
>
|
||||
|
||||
#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
|
||||
BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
typename ::boost::mpl::first<
|
||||
typename BOOST_PARAMETER_arg_list(N)::type
|
||||
>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
|
||||
{
|
||||
typedef typename BOOST_PARAMETER_arg_list(N)::type result;
|
||||
typedef typename ::boost::mpl::first<result>::type result_type;
|
||||
typedef typename ::boost::mpl::second<result>::type error;
|
||||
error();
|
||||
|
||||
return result_type(
|
||||
BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, N)
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#undef BOOST_PARAMETER_arg_list
|
||||
#undef BOOST_PARAMETER_close_list
|
||||
#undef BOOST_PARAMETER_open_list
|
||||
#undef N
|
||||
|
||||
26
src/boost/parameter/aux_/preprocessor/seq_enum.hpp
Normal file
26
src/boost/parameter/aux_/preprocessor/seq_enum.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
// Temporary version of BOOST_PP_SEQ_ENUM
|
||||
// until Paul M. integrates the workaround.
|
||||
#define BOOST_PARAMETER_SEQ_ENUM_I(size, seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
|
||||
#define BOOST_PARAMETER_SEQ_ENUM(seq) \
|
||||
BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
|
||||
#else
|
||||
#define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM(seq)
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
||||
1807
src/boost/parameter/aux_/preprocessor/seq_merge.hpp
Normal file
1807
src/boost/parameter/aux_/preprocessor/seq_merge.hpp
Normal file
File diff suppressed because it is too large
Load diff
53
src/boost/parameter/aux_/result_of0.hpp
Normal file
53
src/boost/parameter/aux_/result_of0.hpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
|
||||
#define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
|
||||
|
||||
#include <boost/parameter/aux_/use_default_tag.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A metafunction returning the result of invoking
|
||||
// a nullary function object of the given type.
|
||||
template <typename F>
|
||||
class result_of0
|
||||
{
|
||||
#if defined(BOOST_NO_RESULT_OF)
|
||||
typedef typename F::result_type result_of_F;
|
||||
#else
|
||||
typedef typename ::boost::result_of<F()>::type result_of_F;
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_if<
|
||||
::std::is_void<result_of_F>
|
||||
#else
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_void<result_of_F>
|
||||
#endif
|
||||
, ::boost::parameter::aux::use_default_tag
|
||||
, result_of_F
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>;
|
||||
#else
|
||||
>::type type;
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
118
src/boost/parameter/aux_/set.hpp
Normal file
118
src/boost/parameter/aux_/set.hpp
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
// Copyright Daniel Wallin 2006.
|
||||
// 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 BOOST_PARAMETER_SET_060912_HPP
|
||||
#define BOOST_PARAMETER_SET_060912_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/list.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef ::boost::mp11::mp_list<> set0;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename S, typename K>
|
||||
struct insert_
|
||||
{
|
||||
using type = ::boost::mp11::mp_insert_c<S,0,K>;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct has_key_
|
||||
{
|
||||
using type = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_empty<Set>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::std::is_same<
|
||||
::boost::mp11::mp_find<Set,K>
|
||||
, ::boost::mp11::mp_size<Set>
|
||||
>
|
||||
>;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/mpl/list.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef ::boost::mpl::list0<> set0;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct insert_ : ::boost::mpl::push_front<Set,K>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/end.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct has_key_
|
||||
{
|
||||
typedef typename ::boost::mpl::find<Set,K>::type iter;
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_same<iter,typename ::boost::mpl::end<Set>::type>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>::type type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !BOOST_PARAMETER_CAN_USE_MP11 && Borland workarounds not needed
|
||||
#include <boost/mpl/set/set0.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef ::boost::mpl::set0<> set0;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/insert.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct insert_ : ::boost::mpl::insert<Set,K>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/has_key.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct has_key_ : ::boost::mpl::has_key<Set,K>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11 || Borland workarounds needed
|
||||
#endif // include guard
|
||||
|
||||
160
src/boost/parameter/aux_/tag.hpp
Normal file
160
src/boost/parameter/aux_/tag.hpp
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// Copyright David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
|
||||
#define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
|
||||
|
||||
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
|
||||
#include <boost/parameter/aux_/tagged_argument.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && \
|
||||
!BOOST_WORKAROUND(BOOST_MSVC, >= 1910)
|
||||
// MSVC-14.1+ assigns rvalue references to tagged_argument instances
|
||||
// instead of tagged_argument_rref instances with this code.
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
struct tag_if_lvalue_reference
|
||||
{
|
||||
using type = ::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux
|
||||
::unwrap_cv_reference<Arg>::type
|
||||
>
|
||||
>;
|
||||
};
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
struct tag_if_scalar
|
||||
{
|
||||
using type = ::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
::boost::parameter::aux
|
||||
::tagged_argument<Keyword,typename ::std::add_const<Arg>::type>
|
||||
>;
|
||||
};
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
using tag_if_otherwise = ::boost::mp11::mp_if<
|
||||
::std::is_scalar<typename ::std::remove_const<Arg>::type>
|
||||
, ::boost::parameter::aux::tag_if_scalar<Keyword,Arg>
|
||||
, ::boost::mp11::mp_identity<
|
||||
::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
>
|
||||
>
|
||||
>;
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
using tag = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_lvalue_reference<Arg>
|
||||
, ::boost::mp11::mp_true
|
||||
, ::boost::parameter::aux::is_cv_reference_wrapper<Arg>
|
||||
>
|
||||
, ::boost::parameter::aux::tag_if_lvalue_reference<Keyword,Arg>
|
||||
, ::boost::parameter::aux::tag_if_otherwise<Keyword,Arg>
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#elif defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename ActualArg>
|
||||
struct tag
|
||||
{
|
||||
typedef typename ::boost::parameter::aux
|
||||
::unwrap_cv_reference<ActualArg>::type Arg;
|
||||
typedef typename ::boost::add_const<Arg>::type ConstArg;
|
||||
typedef typename ::boost::remove_const<Arg>::type MutArg;
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_lvalue_reference<ActualArg>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::parameter::aux::is_cv_reference_wrapper<ActualArg>
|
||||
>::type
|
||||
, ::boost::mpl::identity<
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
#endif
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>
|
||||
#endif
|
||||
>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_scalar<MutArg>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,ConstArg>
|
||||
>
|
||||
, ::boost::parameter::aux::tagged_argument_list_of_1<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
>
|
||||
#else
|
||||
, ::boost::parameter::aux::tagged_argument<Keyword,ConstArg>
|
||||
, ::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
#endif
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Keyword
|
||||
, typename Arg
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
, typename = typename ::boost::parameter::aux
|
||||
::is_cv_reference_wrapper<Arg>::type
|
||||
#endif
|
||||
>
|
||||
struct tag
|
||||
{
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux::unwrap_cv_reference<Arg>::type
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
struct tag<Keyword,Arg,::boost::mpl::false_>
|
||||
{
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::remove_reference<Arg>::type
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#endif // Borland workarounds needed.
|
||||
#endif // MP11 or perfect forwarding support
|
||||
#endif // include guard
|
||||
|
||||
903
src/boost/parameter/aux_/tagged_argument.hpp
Normal file
903
src/boost/parameter/aux_/tagged_argument.hpp
Normal file
|
|
@ -0,0 +1,903 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
|
||||
#define BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct error_const_lvalue_bound_to_out_parameter;
|
||||
struct error_lvalue_bound_to_consume_parameter;
|
||||
struct error_rvalue_bound_to_out_parameter;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/keyword_fwd.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using tagged_argument_type = ::boost::mp11::mp_if<
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_scalar<Arg>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::std::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::consume_reference
|
||||
>
|
||||
>
|
||||
, ::boost::parameter::aux::error_lvalue_bound_to_consume_parameter
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_const<Arg>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::parameter::aux
|
||||
::error_const_lvalue_bound_to_out_parameter
|
||||
, ::std::remove_const<Arg>
|
||||
>
|
||||
, ::boost::mp11::mp_identity<Arg>
|
||||
>
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
struct tagged_argument_type
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::parameter::aux::error_const_lvalue_bound_to_out_parameter
|
||||
, ::boost::remove_const<Arg>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/tagged_argument_fwd.hpp>
|
||||
#include <boost/parameter/aux_/is_tagged_argument.hpp>
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
#include <boost/function.hpp>
|
||||
#else
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Holds an lvalue reference to an argument of type Arg associated with
|
||||
// keyword Keyword
|
||||
template <typename Keyword, typename Arg>
|
||||
class tagged_argument
|
||||
: public ::boost::parameter::aux::tagged_argument_base
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using arg_type = typename ::boost::parameter::aux
|
||||
::tagged_argument_type<Keyword,Arg>::type;
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::eval_if<
|
||||
::boost::is_scalar<Arg>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::consume_reference
|
||||
>
|
||||
>::type
|
||||
, ::boost::parameter::aux::error_lvalue_bound_to_consume_parameter
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_const<Arg>
|
||||
, ::boost::parameter::aux::tagged_argument_type<Keyword,Arg>
|
||||
, ::boost::mpl::identity<Arg>
|
||||
>
|
||||
>::type arg_type;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
public:
|
||||
typedef Keyword key_type;
|
||||
|
||||
// Wrap plain (non-UDT) function objects in either
|
||||
// a boost::function or a std::function. -- Cromwell D. Enage
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using value_type = ::boost::mp11::mp_if<
|
||||
::std::is_function<arg_type>
|
||||
, ::std::function<arg_type>
|
||||
, Arg
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
, ::boost::function<arg_type>
|
||||
#else
|
||||
, ::std::function<arg_type>
|
||||
#endif
|
||||
, Arg
|
||||
>::type value_type;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
// If Arg is void_, then this type will evaluate to void_&. If the
|
||||
// supplied argument is a plain function, then this type will evaluate
|
||||
// to a reference-to-const function wrapper type. If the supplied
|
||||
// argument is an lvalue, then Arg will be deduced to the lvalue
|
||||
// reference. -- Cromwell D. Enage
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using reference = ::boost::mp11::mp_if<
|
||||
::std::is_function<arg_type>
|
||||
, value_type const&
|
||||
, Arg&
|
||||
>;
|
||||
#else
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type const&
|
||||
, Arg&
|
||||
>::type reference;
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Store plain functions by value, everything else by reference.
|
||||
// -- Cromwell D. Enage
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_function<arg_type>
|
||||
, value_type
|
||||
, reference
|
||||
> value;
|
||||
#else
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type
|
||||
, reference
|
||||
>::type value;
|
||||
#endif
|
||||
|
||||
public:
|
||||
inline explicit BOOST_CONSTEXPR tagged_argument(reference x)
|
||||
: value(x)
|
||||
{
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR tagged_argument(tagged_argument const& copy)
|
||||
: value(copy.value)
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::is_same<KW,key_type>
|
||||
, ::boost::mpl::if_<Reference,reference,value_type>
|
||||
, ::boost::mpl::identity<Default>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
using fn = ::boost::mp11::mp_if<
|
||||
::std::is_same<KW,key_type>
|
||||
, ::boost::mp11::mp_if<Reference,reference,value_type>
|
||||
, Default
|
||||
>;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument_rref<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, boost::parameter::aux::arg_list<
|
||||
boost::parameter::aux::tagged_argument_rref<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux
|
||||
::tagged_argument_rref<Keyword2,Arg2>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
// Accessor interface.
|
||||
inline BOOST_CONSTEXPR reference get_value() const
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](::boost::parameter::keyword<Keyword> const&) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return ::std::forward<Default>(x.value);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline BOOST_CONSTEXPR
|
||||
typename ::boost::parameter::aux::result_of0<F>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename ParameterRequirements>
|
||||
static BOOST_CONSTEXPR typename ParameterRequirements::has_default
|
||||
satisfies(ParameterRequirements*);
|
||||
|
||||
template <typename HasDefault, typename Predicate>
|
||||
static BOOST_CONSTEXPR
|
||||
typename ::boost::mpl::apply_wrap1<Predicate,value_type>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
key_type
|
||||
, Predicate
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
typedef ::boost::parameter::aux::tagged_argument<Keyword,Arg> type;
|
||||
// For the benefit of iterators
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename Keyword>
|
||||
using tagged_argument_rref_key = ::boost::mp11::mp_if<
|
||||
::std::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::parameter::aux::error_rvalue_bound_to_out_parameter
|
||||
, ::boost::mp11::mp_identity<Keyword>
|
||||
>;
|
||||
#endif
|
||||
|
||||
// Holds an rvalue reference to an argument of type Arg associated with
|
||||
// keyword Keyword
|
||||
template <typename Keyword, typename Arg>
|
||||
struct tagged_argument_rref
|
||||
: ::boost::parameter::aux::tagged_argument_base
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using key_type = typename ::boost::parameter::aux
|
||||
::tagged_argument_rref_key<Keyword>::type;
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Keyword::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::parameter::aux::error_rvalue_bound_to_out_parameter
|
||||
, ::boost::mpl::identity<Keyword>
|
||||
>::type key_type;
|
||||
#endif
|
||||
typedef Arg value_type;
|
||||
typedef Arg&& reference;
|
||||
|
||||
private:
|
||||
reference value;
|
||||
|
||||
public:
|
||||
inline explicit BOOST_CONSTEXPR tagged_argument_rref(reference x)
|
||||
: value(::std::forward<Arg>(x))
|
||||
{
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR tagged_argument_rref(
|
||||
tagged_argument_rref const& copy
|
||||
) : value(::std::forward<Arg>(copy.value))
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<KW,key_type>
|
||||
, ::boost::mpl::if_<Reference,reference,value_type>
|
||||
, ::boost::mpl::identity<Default>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
using fn = ::boost::mp11::mp_if<
|
||||
::std::is_same<KW,key_type>
|
||||
, ::boost::mp11::mp_if<Reference,reference,value_type>
|
||||
, Default
|
||||
>;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument_rref<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux
|
||||
::tagged_argument_rref<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<
|
||||
Keyword2
|
||||
, Arg2
|
||||
>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
|
||||
// Accessor interface.
|
||||
inline BOOST_CONSTEXPR reference get_value() const
|
||||
{
|
||||
return ::std::forward<Arg>(this->value);
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](::boost::parameter::keyword<Keyword> const&) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return ::std::forward<Default>(x.value);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline BOOST_CONSTEXPR
|
||||
typename ::boost::parameter::aux::result_of0<F>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename ParameterRequirements>
|
||||
static BOOST_CONSTEXPR typename ParameterRequirements::has_default
|
||||
satisfies(ParameterRequirements*);
|
||||
|
||||
template <typename HasDefault, typename Predicate>
|
||||
static BOOST_CONSTEXPR
|
||||
typename ::boost::mpl::apply_wrap1<Predicate,value_type>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
key_type
|
||||
, Predicate
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
typedef ::boost::parameter::aux
|
||||
::tagged_argument_rref<Keyword,Arg> type;
|
||||
// For the benefit of iterators
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Holds an lvalue reference to an argument of type Arg associated with
|
||||
// keyword Keyword
|
||||
template <typename Keyword, typename Arg>
|
||||
class tagged_argument
|
||||
: public ::boost::parameter::aux::tagged_argument_base
|
||||
{
|
||||
typedef typename ::boost::remove_const<Arg>::type arg_type;
|
||||
|
||||
public:
|
||||
typedef Keyword key_type;
|
||||
|
||||
// Wrap plain (non-UDT) function objects in either
|
||||
// a boost::function or a std::function. -- Cromwell D. Enage
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
, ::boost::function<arg_type>
|
||||
#else
|
||||
, ::std::function<arg_type>
|
||||
#endif
|
||||
, Arg
|
||||
>::type value_type;
|
||||
|
||||
// If Arg is void_, then this type will evaluate to void_&. If the
|
||||
// supplied argument is a plain function, then this type will evaluate
|
||||
// to a reference-to-const function wrapper type. If the supplied
|
||||
// argument is an lvalue, then Arg will be deduced to the lvalue
|
||||
// reference. -- Cromwell D. Enage
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type const&
|
||||
, Arg&
|
||||
>::type reference;
|
||||
|
||||
private:
|
||||
// Store plain functions by value, everything else by reference.
|
||||
// -- Cromwell D. Enage
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type
|
||||
, reference
|
||||
>::type value;
|
||||
|
||||
public:
|
||||
inline explicit BOOST_CONSTEXPR tagged_argument(reference x)
|
||||
: value(x)
|
||||
{
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR tagged_argument(tagged_argument const& copy)
|
||||
: value(copy.value)
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<KW,key_type>
|
||||
, ::boost::mpl::if_<Reference,reference,value_type>
|
||||
, ::boost::mpl::identity<Default>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
|
||||
// Accessor interface.
|
||||
inline BOOST_CONSTEXPR reference get_value() const
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](::boost::parameter::keyword<Keyword> const&) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || \
|
||||
BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, Default&
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_default(x, 0L);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline BOOST_CONSTEXPR
|
||||
typename ::boost::parameter::aux::result_of0<F>::type
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline BOOST_CONSTEXPR typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, typename ::boost::parameter::aux::result_of0<F>::type
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_lazy_default(x, 0L);
|
||||
}
|
||||
#else // No function template ordering or Borland workarounds needed.
|
||||
template <typename Default>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline BOOST_CONSTEXPR reference
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline BOOST_CONSTEXPR Default&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline BOOST_CONSTEXPR
|
||||
typename ::boost::parameter::aux::result_of0<F>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename ParameterRequirements>
|
||||
static BOOST_CONSTEXPR typename ParameterRequirements::has_default
|
||||
satisfies(ParameterRequirements*);
|
||||
|
||||
template <typename HasDefault, typename Predicate>
|
||||
static BOOST_CONSTEXPR
|
||||
typename ::boost::mpl::apply_wrap1<Predicate,value_type>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
key_type
|
||||
, Predicate
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
#endif // Function template ordering, Borland workarounds needed.
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
typedef ::boost::parameter::aux::tagged_argument<Keyword,Arg> type;
|
||||
// For the benefit of iterators
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
// warning suppression
|
||||
private:
|
||||
void operator=(type const&);
|
||||
#endif
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename TaggedArg>
|
||||
struct tagged_argument_list_of_1 : public TaggedArg
|
||||
{
|
||||
using base_type = TaggedArg;
|
||||
|
||||
inline explicit BOOST_CONSTEXPR tagged_argument_list_of_1(
|
||||
typename base_type::reference x
|
||||
) : base_type(static_cast<typename base_type::reference>(x))
|
||||
{
|
||||
}
|
||||
|
||||
inline BOOST_CONSTEXPR tagged_argument_list_of_1(
|
||||
tagged_argument_list_of_1 const& copy
|
||||
) : base_type(static_cast<base_type const&>(copy))
|
||||
{
|
||||
}
|
||||
|
||||
using base_type::operator[];
|
||||
using base_type::satisfies;
|
||||
|
||||
template <typename TA2>
|
||||
inline BOOST_CONSTEXPR ::boost::parameter::aux::flat_like_arg_list<
|
||||
::boost::parameter::aux
|
||||
::flat_like_arg_tuple<typename TaggedArg::key_type,TaggedArg>
|
||||
, ::boost::parameter::aux::flat_like_arg_tuple<
|
||||
typename TA2::base_type::key_type
|
||||
, typename TA2::base_type
|
||||
>
|
||||
>
|
||||
operator,(TA2 const& x) const
|
||||
{
|
||||
return boost::parameter::aux::flat_like_arg_list<
|
||||
::boost::parameter::aux
|
||||
::flat_like_arg_tuple<typename TaggedArg::key_type,TaggedArg>
|
||||
, ::boost::parameter::aux::flat_like_arg_tuple<
|
||||
typename TA2::base_type::key_type
|
||||
, typename TA2::base_type
|
||||
>
|
||||
>(
|
||||
static_cast<base_type const&>(*this)
|
||||
, ::boost::parameter::aux::arg_list<typename TA2::base_type>(
|
||||
static_cast<typename TA2::base_type const&>(x)
|
||||
, ::boost::parameter::aux::empty_arg_list()
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
38
src/boost/parameter/aux_/tagged_argument_fwd.hpp
Normal file
38
src/boost/parameter/aux_/tagged_argument_fwd.hpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
|
||||
#define BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
class tagged_argument;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Keyword, typename Arg>
|
||||
struct tagged_argument_rref;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename TaggedArg>
|
||||
struct tagged_argument_list_of_1;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif
|
||||
#endif // include guard
|
||||
|
||||
89
src/boost/parameter/aux_/template_keyword.hpp
Normal file
89
src/boost/parameter/aux_/template_keyword.hpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
// Copyright Daniel Wallin 2006.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
|
||||
#define BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct template_keyword_base
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
using is_template_keyword = ::std::is_base_of<
|
||||
::boost::parameter::aux::template_keyword_base
|
||||
, typename ::std::remove_const<
|
||||
typename ::std::remove_reference<T>::type
|
||||
>::type
|
||||
>;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#else
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
template <typename T>
|
||||
struct is_template_keyword_aux
|
||||
: ::boost::mpl::if_<
|
||||
::boost::is_convertible<
|
||||
T*
|
||||
, ::boost::parameter::aux::template_keyword_base const*
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
template <typename T>
|
||||
struct is_template_keyword
|
||||
: ::boost::mpl::if_<
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
// Cannot use is_convertible<> to check if T is derived from
|
||||
// template_keyword_base. -- Cromwell D. Enage
|
||||
::boost::is_base_of<
|
||||
::boost::parameter::aux::template_keyword_base
|
||||
, typename ::boost::remove_const<
|
||||
typename ::boost::remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
#else
|
||||
::boost::is_lvalue_reference<T>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::parameter::aux::is_template_keyword_aux<T>
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
174
src/boost/parameter/aux_/unwrap_cv_reference.hpp
Normal file
174
src/boost/parameter/aux_/unwrap_cv_reference.hpp
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_AUX_UNWRAP_CV_REFERENCE_HPP
|
||||
#define BOOST_PARAMETER_AUX_UNWRAP_CV_REFERENCE_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
class reference_wrapper;
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
//
|
||||
// reference_wrapper support -- if perfect forwarding is unsupported,
|
||||
// then when passing arguments positionally by non-const reference,
|
||||
// we ask users of named parameter interfaces to use ref(x) to wrap them.
|
||||
//
|
||||
|
||||
template <typename U>
|
||||
::boost::parameter::aux::yes_tag
|
||||
is_cv_reference_wrapper_check(
|
||||
::boost::reference_wrapper<U> const volatile*
|
||||
);
|
||||
|
||||
::boost::parameter::aux::no_tag is_cv_reference_wrapper_check(...);
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
#include <functional>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Support for std::ref(x) -- Cromwell D. Enage
|
||||
template <typename U>
|
||||
::boost::parameter::aux::yes_tag
|
||||
is_cv_reference_wrapper_check(
|
||||
::std::reference_wrapper<U> const volatile*
|
||||
);
|
||||
}}} // namespace boost::parameter::aux
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && !( \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1900) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1910) \
|
||||
)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11) || MSVC-14.0
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#endif
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11 && not MSVC-14.0
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && !( \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1900) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1910) \
|
||||
)
|
||||
// This metafunction returns mp11::mp_true if T is of type
|
||||
// reference_wrapper<U> cv.
|
||||
template <typename T>
|
||||
using is_cv_reference_wrapper = ::boost::mp11::mp_bool<
|
||||
sizeof(
|
||||
::boost::parameter::aux::is_cv_reference_wrapper_check(
|
||||
static_cast<
|
||||
typename ::std::remove_reference<T>::type*
|
||||
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::yes_tag)
|
||||
>;
|
||||
|
||||
// Needed for unwrap_cv_reference below. T might be const, so
|
||||
// mp_eval_if<> might fail because of deriving from T const on EDG.
|
||||
template <typename T>
|
||||
using unwrap_cv_reference_impl = typename ::std::remove_reference<T>::type;
|
||||
|
||||
// Produces the unwrapped type to hold a reference to in
|
||||
// tagged_argument<>. Can't use boost::unwrap_reference<> here
|
||||
// because it doesn't handle the case where T = reference_wrapper<U> cv.
|
||||
template <typename T>
|
||||
using unwrap_cv_reference = ::boost::mp11::mp_eval_if<
|
||||
::boost::parameter::aux::is_cv_reference_wrapper<T>
|
||||
, ::boost::parameter::aux::unwrap_cv_reference_impl<T>
|
||||
, ::std::remove_reference
|
||||
, T
|
||||
>;
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11) || MSVC-14.0
|
||||
// This metafunction returns mpl::true_ if T is of type
|
||||
// reference_wrapper<U> cv.
|
||||
template <typename T>
|
||||
struct is_cv_reference_wrapper
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = (
|
||||
sizeof(
|
||||
::boost::parameter::aux::is_cv_reference_wrapper_check(
|
||||
static_cast<
|
||||
typename ::boost::remove_reference<T>::type*
|
||||
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::yes_tag)
|
||||
)
|
||||
);
|
||||
|
||||
typedef boost::mpl::bool_<
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
is_cv_reference_wrapper::
|
||||
#endif
|
||||
value> type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) || \
|
||||
BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
template <
|
||||
typename T
|
||||
, typename = typename ::boost::parameter::aux
|
||||
::is_cv_reference_wrapper<T>::type
|
||||
>
|
||||
struct unwrap_cv_reference : ::boost::remove_reference<T>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct unwrap_cv_reference<T const,::boost::mpl::false_>
|
||||
{
|
||||
typedef T const type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct unwrap_cv_reference<T,::boost::mpl::true_> : T
|
||||
{
|
||||
};
|
||||
#else // no Borland or GCC 3- workarounds needed
|
||||
// Needed for unwrap_cv_reference below. T might be const, so
|
||||
// eval_if<> might fail because of deriving from T const on EDG.
|
||||
template <typename T>
|
||||
struct unwrap_cv_reference_impl : ::boost::remove_reference<T>::type
|
||||
{
|
||||
};
|
||||
|
||||
// Produces the unwrapped type to hold a reference to in
|
||||
// tagged_argument<>. Can't use boost::unwrap_reference<> here
|
||||
// because it doesn't handle the case where T = reference_wrapper<U> cv.
|
||||
template <typename T>
|
||||
struct unwrap_cv_reference
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_cv_reference_wrapper<T>
|
||||
, ::boost::parameter::aux::unwrap_cv_reference_impl<T>
|
||||
, ::boost::remove_reference<T>
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // Borland or GCC 3- workarounds needed
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11 && not MSVC-14.0
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
17
src/boost/parameter/aux_/use_default.hpp
Normal file
17
src/boost/parameter/aux_/use_default.hpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// 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 BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
|
||||
#define BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct use_default
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
29
src/boost/parameter/aux_/use_default_tag.hpp
Normal file
29
src/boost/parameter/aux_/use_default_tag.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright Daniel Wallin 2006.
|
||||
// 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 BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
|
||||
#define BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct use_default_tag
|
||||
{
|
||||
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(use_default_tag(), {})
|
||||
|
||||
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(
|
||||
use_default_tag(use_default_tag const&), {}
|
||||
)
|
||||
|
||||
inline BOOST_CONSTEXPR use_default_tag operator()() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
38
src/boost/parameter/aux_/void.hpp
Normal file
38
src/boost/parameter/aux_/void.hpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_VOID_050329_HPP
|
||||
#define BOOST_PARAMETER_VOID_050329_HPP
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A placemarker for "no argument passed."
|
||||
// MAINTAINER NOTE: Do not make this into a metafunction
|
||||
struct void_
|
||||
{
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
inline ::boost::parameter::void_& void_reference()
|
||||
{
|
||||
static ::boost::parameter::void_ instance;
|
||||
return instance;
|
||||
}
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef void* voidstar;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif
|
||||
#endif // include guard
|
||||
|
||||
42
src/boost/parameter/aux_/yesno.hpp
Normal file
42
src/boost/parameter/aux_/yesno.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_AUX_YESNO_HPP
|
||||
#define BOOST_PARAMETER_AUX_YESNO_HPP
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// types used with the "sizeof trick" to capture the results of
|
||||
// overload resolution at compile-time.
|
||||
typedef char yes_tag;
|
||||
typedef char (&no_tag)[2];
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// mpl::true_ and mpl::false_ are not distinguishable by sizeof(),
|
||||
// so we pass them through these functions to get a type that is.
|
||||
::boost::parameter::aux::yes_tag to_yesno(::boost::mpl::true_);
|
||||
::boost::parameter::aux::no_tag to_yesno(::boost::mpl::false_);
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// mp11::mp_true and mp11::mp_false are not distinguishable by sizeof(),
|
||||
// so we pass them through these functions to get a type that is.
|
||||
::boost::parameter::aux::yes_tag to_yesno(::boost::mp11::mp_true);
|
||||
::boost::parameter::aux::no_tag to_yesno(::boost::mp11::mp_false);
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // include guard
|
||||
|
||||
164
src/boost/parameter/binding.hpp
Normal file
164
src/boost/parameter/binding.hpp
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
// Copyright David Abrahams 2005.
|
||||
// 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 BOOST_PARAMETER_BINDING_DWA200558_HPP
|
||||
#define BOOST_PARAMETER_BINDING_DWA200558_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A metafunction that, given an argument pack, returns the reference type
|
||||
// of the parameter identified by the given keyword. If no such parameter
|
||||
// has been specified, returns Default
|
||||
|
||||
template <typename Parameters, typename Keyword, typename Default>
|
||||
struct binding0
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
typename Parameters::binding
|
||||
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
|
||||
>;
|
||||
|
||||
static_assert(
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, ::boost::mp11::mp_true
|
||||
>::value
|
||||
, "required parameters must not result in void_ type"
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::mpl::apply_wrap3<
|
||||
typename Parameters::binding
|
||||
, Keyword
|
||||
, Default
|
||||
, ::boost::mpl::true_
|
||||
>::type type;
|
||||
|
||||
BOOST_MPL_ASSERT((
|
||||
typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
));
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename Placeholder, typename Keyword, typename Default>
|
||||
struct binding1
|
||||
{
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
Placeholder
|
||||
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
|
||||
>;
|
||||
|
||||
static_assert(
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, ::boost::mp11::mp_true
|
||||
>::value
|
||||
, "required parameters must not result in void_ type"
|
||||
);
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/is_placeholder.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <
|
||||
typename Parameters
|
||||
, typename Keyword
|
||||
, typename Default = ::boost::parameter::void_
|
||||
>
|
||||
struct binding
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_mpl_placeholder<Parameters>
|
||||
, ::boost::mpl::identity<int>
|
||||
, ::boost::parameter::binding0<Parameters,Keyword,Default>
|
||||
>
|
||||
#endif
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = typename ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_mpl_placeholder<Parameters>
|
||||
, ::boost::mp11::mp_identity<int>
|
||||
, ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_mp11_placeholder<Parameters>
|
||||
, ::boost::parameter::binding1<Parameters,Keyword,Default>
|
||||
, ::boost::parameter::binding0<Parameters,Keyword,Default>
|
||||
>
|
||||
>::type;
|
||||
#endif
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A metafunction that, given an argument pack, returns the reference type
|
||||
// of the parameter identified by the given keyword. If no such parameter
|
||||
// has been specified, returns the type returned by invoking DefaultFn
|
||||
template <typename Parameters, typename Keyword, typename DefaultFn>
|
||||
struct lazy_binding
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
typename Parameters::binding
|
||||
, ::boost::mp11::mp_list<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
>;
|
||||
#else
|
||||
typedef typename ::boost::mpl::apply_wrap3<
|
||||
typename Parameters::binding
|
||||
, Keyword
|
||||
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
|
||||
, ::boost::mpl::true_
|
||||
>::type type;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#endif // include guard
|
||||
|
||||
83
src/boost/parameter/config.hpp
Normal file
83
src/boost/parameter/config.hpp
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
// Copyright Daniel Wallin, David Abrahams 2005.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
#define BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
// Allow projects to #define BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING to
|
||||
// turn off perfect forwarding as necessary. Otherwise, also require correct
|
||||
// SFINAE support, needed explicitly by tagged_argument & keyword & cast;
|
||||
// correct function template ordering, needed by the code generation macros;
|
||||
// rvalue references, needed throughout; variadic templates, needed by
|
||||
// parameters; function template default arguments, needed by the code
|
||||
// generation macros; and the ability to handle multiple parameter packs,
|
||||
// needed by parameters. Older versions of GCC either don't have the latter
|
||||
// ability or cannot disambiguate between keyword's overloaded
|
||||
// operators. Older versions of Clang either fail to compile due to
|
||||
// differences in length between parameter packs 'Args' and 'args' or fail at
|
||||
// runtime due to segmentation faults.
|
||||
// -- Cromwell D. Enage
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
!defined(BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING) && \
|
||||
!defined(BOOST_NO_SFINAE) && \
|
||||
!defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) && \
|
||||
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
|
||||
!defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
|
||||
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && !( \
|
||||
defined(BOOST_CLANG) && (1 == BOOST_CLANG) && ( \
|
||||
(__clang_major__ < 3) || ( \
|
||||
(3 == __clang_major__) && (__clang_minor__ < 2) \
|
||||
) \
|
||||
) \
|
||||
) && !BOOST_WORKAROUND(BOOST_GCC, < 40900)
|
||||
#define BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11) && \
|
||||
!defined(BOOST_PARAMETER_DISABLE_MP11_USAGE) && \
|
||||
!defined(BOOST_NO_CXX11_CONSTEXPR) && \
|
||||
!defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
|
||||
!defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \
|
||||
!defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \
|
||||
!defined(BOOST_NO_CXX11_STATIC_ASSERT) && \
|
||||
!defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && \
|
||||
!defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && \
|
||||
!defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||
// Boost.MP11 requires C++11. -- Cromwell D. Enage
|
||||
#define BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif
|
||||
#if !defined(BOOST_PARAMETER_MAX_ARITY)
|
||||
// Unlike the variadic MPL sequences provided by Boost.Fusion,
|
||||
// boost::mpl::vector has a size limit. -- Cromwell D. Enage
|
||||
#include <boost/mpl/limits/vector.hpp>
|
||||
#define BOOST_PARAMETER_MAX_ARITY BOOST_MPL_LIMIT_VECTOR_SIZE
|
||||
#endif
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if !defined(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY 0
|
||||
#endif
|
||||
#if !defined(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1800) || \
|
||||
BOOST_WORKAROUND(BOOST_GCC, < 60000)
|
||||
// Some tests cause MSVC-11.0 and earlier to run out of heap space,
|
||||
// while some other tests cause GCC 5 and earlier to do the same,
|
||||
// if the value is set any higher. -- Cromwell D. Enage
|
||||
#define BOOST_PARAMETER_COMPOSE_MAX_ARITY 20
|
||||
#else
|
||||
#define BOOST_PARAMETER_COMPOSE_MAX_ARITY 64
|
||||
#endif
|
||||
#endif // BOOST_PARAMETER_COMPOSE_MAX_ARITY
|
||||
#if !defined(BOOST_PARAMETER_MAX_ARITY)
|
||||
#define BOOST_PARAMETER_MAX_ARITY 8
|
||||
#endif
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
132
src/boost/parameter/deduced.hpp
Normal file
132
src/boost/parameter/deduced.hpp
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
// 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 BOOST_PARAMETER_DEDUCED_HPP
|
||||
#define BOOST_PARAMETER_DEDUCED_HPP
|
||||
|
||||
#include <boost/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.
|
||||
//
|
||||
// If a keyword k is specified with deduced<...>, that keyword
|
||||
// will be automatically deduced from the argument list.
|
||||
template <typename Tag>
|
||||
struct deduced
|
||||
{
|
||||
typedef Tag key_type;
|
||||
};
|
||||
}}
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_deduced_aux
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_false
|
||||
#else
|
||||
: ::boost::mpl::false_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Tag>
|
||||
struct is_deduced_aux< ::boost::parameter::deduced<Tag> >
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_true
|
||||
#else
|
||||
: ::boost::mpl::true_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_deduced0
|
||||
: ::boost::parameter::aux::is_deduced_aux<typename T::key_type>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/required.hpp>
|
||||
#include <boost/parameter/optional.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#else
|
||||
#include <boost/mpl/if.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
//
|
||||
// tag_type, has_default, and predicate --
|
||||
//
|
||||
// These metafunctions accept a ParameterSpec and extract the
|
||||
// keyword tag, whether or not a default is supplied for the
|
||||
// parameter, and the predicate that the corresponding actual
|
||||
// argument type is required match.
|
||||
//
|
||||
// a ParameterSpec is a specialization of either keyword<...>,
|
||||
// required<...>, optional<...>
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using has_default = ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_required<T>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>;
|
||||
#else
|
||||
struct has_default
|
||||
: ::boost::mpl::if_<
|
||||
::boost::parameter::aux::is_required<T>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using is_deduced = ::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::is_deduced0<T>
|
||||
, ::boost::mp11::mp_false
|
||||
>;
|
||||
#else
|
||||
struct is_deduced
|
||||
: ::boost::mpl::if_<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::parameter::aux::is_optional<T>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::parameter::aux::is_required<T>
|
||||
>::type
|
||||
, ::boost::parameter::aux::is_deduced0<T>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
23
src/boost/parameter/keyword_fwd.hpp
Normal file
23
src/boost/parameter/keyword_fwd.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_KEYWORD_FWD_HPP
|
||||
#define BOOST_PARAMETER_KEYWORD_FWD_HPP
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
struct in_reference;
|
||||
struct out_reference;
|
||||
typedef ::boost::parameter::out_reference in_out_reference;
|
||||
struct forward_reference;
|
||||
struct consume_reference;
|
||||
typedef ::boost::parameter::consume_reference move_from_reference;
|
||||
|
||||
template <typename Tag>
|
||||
struct keyword;
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#endif // include guard
|
||||
|
||||
67
src/boost/parameter/optional.hpp
Normal file
67
src/boost/parameter/optional.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// 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 BOOST_PARAMETER_OPTIONAL_HPP
|
||||
#define BOOST_PARAMETER_OPTIONAL_HPP
|
||||
|
||||
#include <boost/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 <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_optional
|
||||
#if defined(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(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_true
|
||||
#else
|
||||
: ::boost::mpl::true_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
600
src/boost/parameter/parameters.hpp
Normal file
600
src/boost/parameter/parameters.hpp
Normal file
|
|
@ -0,0 +1,600 @@
|
|||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETERS_031014_HPP
|
||||
#define BOOST_PARAMETERS_031014_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// The make_arg_list<> metafunction produces a reversed arg_list,
|
||||
// so pass the arguments to the arg_list constructor reversed in turn.
|
||||
template <typename ArgList, typename ...Args>
|
||||
struct arg_list_factory;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <utility>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// TODO: Reduce template code bloat. -- Cromwell D. Enage
|
||||
template <typename ArgList>
|
||||
struct arg_list_factory<ArgList>
|
||||
{
|
||||
template <typename ...ReversedArgs>
|
||||
static inline BOOST_CONSTEXPR ArgList
|
||||
reverse(ReversedArgs&&... reversed_args)
|
||||
{
|
||||
return ArgList(
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<
|
||||
#else
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
#endif
|
||||
typename ArgList::tagged_arg::value_type
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
, ::boost::parameter::aux::value_type_is_void
|
||||
, ::boost::parameter::aux::value_type_is_not_void
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
>()
|
||||
#else
|
||||
>::type()
|
||||
#endif
|
||||
, ::std::forward<ReversedArgs>(reversed_args)...
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ArgList, typename A0, typename ...Args>
|
||||
struct arg_list_factory<ArgList,A0,Args...>
|
||||
{
|
||||
template <typename ...ReversedArgs>
|
||||
static inline BOOST_CONSTEXPR ArgList
|
||||
reverse(A0&& a0, Args&&... args, ReversedArgs&&... reversed_args)
|
||||
{
|
||||
return ::boost::parameter::aux
|
||||
::arg_list_factory<ArgList,Args...>::reverse(
|
||||
::std::forward<Args>(args)...
|
||||
, ::std::forward<A0>(a0)
|
||||
, ::std::forward<ReversedArgs>(reversed_args)...
|
||||
);
|
||||
}
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_template_keyword_arg.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE)
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
//#include <boost/mp11/mpl.hpp>
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mp11::mp_list
|
||||
#else
|
||||
#include <boost/fusion/container/list/list_fwd.hpp>
|
||||
|
||||
// Newer versions of MSVC fail on the evaluate_category and
|
||||
// preprocessor_eval_category test programs when parameters uses
|
||||
// boost::fusion::list.
|
||||
// -- Cromwell D. Enage
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_LIST) && ( \
|
||||
!defined(BOOST_MSVC) || (BOOST_MSVC < 1800) \
|
||||
)
|
||||
#include <boost/fusion/container/list.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::fusion::list
|
||||
#else
|
||||
#include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#include <boost/fusion/container/deque.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::fusion::deque
|
||||
#else
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mpl::vector
|
||||
#endif // BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
#endif // BOOST_FUSION_HAS_VARIADIC_LIST
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename ...Spec>
|
||||
struct parameters
|
||||
{
|
||||
typedef BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE<Spec...> parameter_spec;
|
||||
|
||||
typedef typename ::boost::parameter::aux
|
||||
::make_deduced_list<parameter_spec>::type deduced_list;
|
||||
|
||||
// If the elements of NamedList match the criteria of overload
|
||||
// resolution, returns a type which can be constructed from
|
||||
// parameters. Otherwise, this is not a valid metafunction
|
||||
// (no nested ::type).
|
||||
template <typename ArgumentPackAndError>
|
||||
struct match_base
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mpl::if_<
|
||||
typename ::boost::parameter::aux::match_parameters_base_cond<
|
||||
ArgumentPackAndError
|
||||
, parameter_spec
|
||||
>::type
|
||||
, ::boost::mpl::identity<
|
||||
::boost::parameter::parameters<Spec...>
|
||||
>
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
#endif
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_if<
|
||||
typename ::boost::parameter::aux::match_parameters_base_cond<
|
||||
ArgumentPackAndError
|
||||
, parameter_spec
|
||||
>::type
|
||||
, ::boost::mp11::mp_identity<
|
||||
::boost::parameter::parameters<Spec...>
|
||||
>
|
||||
, ::boost::parameter::void_
|
||||
>;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Specializations are to be used as an optional argument
|
||||
// to eliminate overloads via SFINAE.
|
||||
template <typename ...Args>
|
||||
struct match
|
||||
: ::boost::parameter::parameters<Spec...>
|
||||
::BOOST_NESTED_TEMPLATE match_base<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename ::boost::parameter::aux
|
||||
::make_parameter_spec_items<parameter_spec,Args...>::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
// Don't emit errors when doing SFINAE.
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, ::boost::mp11::mp_false
|
||||
#else
|
||||
, ::boost::mpl::false_
|
||||
#endif
|
||||
>::type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
// Metafunction that returns an ArgumentPack.
|
||||
template <typename ...Args>
|
||||
struct bind
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mpl::first<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename ::boost::parameter::aux
|
||||
::make_parameter_spec_items<parameter_spec,Args...>::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_template_keyword_arg
|
||||
>::type
|
||||
>
|
||||
#endif
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_at_c<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename ::boost::parameter::aux
|
||||
::make_parameter_spec_items<parameter_spec,Args...>::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_template_keyword_arg
|
||||
>::type
|
||||
, 0
|
||||
>;
|
||||
#endif
|
||||
};
|
||||
|
||||
// The function call operator is used to build an arg_list that
|
||||
// labels the positional parameters and maintains whatever other
|
||||
// tags may have been specified by the caller.
|
||||
inline ::boost::parameter::aux::empty_arg_list operator()() const
|
||||
{
|
||||
return ::boost::parameter::aux::empty_arg_list();
|
||||
}
|
||||
|
||||
template <typename A0, typename ...Args>
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
inline ::boost::mp11::mp_at_c<
|
||||
#else
|
||||
inline typename ::boost::mpl::first<
|
||||
#endif
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename ::boost::parameter::aux
|
||||
::make_parameter_spec_items<parameter_spec,A0,Args...>::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
>::type
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
, 0
|
||||
>
|
||||
#else
|
||||
>::type
|
||||
#endif
|
||||
operator()(A0&& a0, Args&& ...args) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
typename ::boost::parameter::aux
|
||||
::make_parameter_spec_items<parameter_spec,A0,Args...>::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
>::type list_error_pair;
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using result_type = ::boost::mp11::mp_at_c<list_error_pair,0>;
|
||||
|
||||
using error = ::boost::mp11::mp_at_c<list_error_pair,1>;
|
||||
#else
|
||||
typedef typename ::boost::mpl
|
||||
::first<list_error_pair>::type result_type;
|
||||
|
||||
typedef typename ::boost::mpl
|
||||
::second<list_error_pair>::type error;
|
||||
#endif
|
||||
|
||||
error();
|
||||
|
||||
return ::boost::parameter::aux
|
||||
::arg_list_factory<result_type,A0,Args...>::reverse(
|
||||
::std::forward<A0>(a0)
|
||||
, ::std::forward<Args>(args)...
|
||||
);
|
||||
}
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_items.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_deduced_items.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_template_keyword_arg.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/selection/min.hpp>
|
||||
|
||||
#if ( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
)
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#else
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <
|
||||
typename PS0
|
||||
, BOOST_PP_ENUM_SHIFTED(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_template_args
|
||||
, PS
|
||||
)
|
||||
>
|
||||
struct parameters
|
||||
{
|
||||
typedef typename BOOST_PARAMETER_build_deduced_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_deduced_items
|
||||
, PS
|
||||
)::type deduced_list;
|
||||
|
||||
// If the elements of NamedList match the criteria of overload
|
||||
// resolution, returns a type which can be constructed from
|
||||
// parameters. Otherwise, this is not a valid metafunction
|
||||
// (no nested ::type).
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
|
||||
// If NamedList satisfies the PS0, PS1, ..., this is a metafunction
|
||||
// returning parameters. Otherwise it has no nested ::type.
|
||||
template <typename ArgumentPackAndError>
|
||||
struct match_base
|
||||
: ::boost::mpl::if_<
|
||||
// ::boost::mpl::and_<
|
||||
// aux::satisfies_requirements_of<NamedList,PS0>
|
||||
// , ::boost::mpl::and_<
|
||||
// aux::satisfies_requirements_of<NamedList,PS1>...
|
||||
// ..., ::boost::mpl::true_
|
||||
// ...> >
|
||||
typename BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_satisfies_begin
|
||||
, PS
|
||||
)
|
||||
::boost::is_same<
|
||||
typename ::boost::mpl
|
||||
::second<ArgumentPackAndError>::type
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_satisfies_end
|
||||
, ::boost::mpl::false_
|
||||
)::type
|
||||
, ::boost::mpl::identity<
|
||||
::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
>
|
||||
>
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // SFINAE enabled, not Borland
|
||||
|
||||
// Specializations are to be used as an optional argument
|
||||
// to eliminate overloads via SFINAE.
|
||||
template <
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
// Borland simply can't handle default arguments in member
|
||||
// class templates. People wishing to write portable code can
|
||||
// explicitly specify BOOST_PARAMETER_MAX_ARITY arguments.
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
|
||||
#else
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, typename A
|
||||
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
|
||||
)
|
||||
#endif
|
||||
>
|
||||
struct match
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
|
||||
: ::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
>::BOOST_NESTED_TEMPLATE match_base<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename BOOST_PARAMETER_build_arg_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_items
|
||||
, PS
|
||||
, A
|
||||
)::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
// Don't emit errors when doing SFINAE.
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#else
|
||||
{
|
||||
typedef ::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
> type;
|
||||
};
|
||||
#endif // SFINAE enabled, not Borland
|
||||
|
||||
// Metafunction that returns an ArgumentPack.
|
||||
|
||||
// TODO, bind has to instantiate the error type in the result
|
||||
// of make_arg_list.
|
||||
|
||||
template <
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
// Borland simply can't handle default arguments in member
|
||||
// class templates. People wishing to write portable code can
|
||||
// explicitly specify BOOST_PARAMETER_MAX_ARITY arguments.
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
|
||||
#else
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, typename A
|
||||
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
|
||||
)
|
||||
#endif
|
||||
>
|
||||
struct bind
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
typename BOOST_PARAMETER_build_arg_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_items
|
||||
, PS
|
||||
, A
|
||||
)::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_template_keyword_arg
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type type;
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_forward_typedef
|
||||
, (PS)(parameter_spec)
|
||||
)
|
||||
|
||||
// The function call operator is used to build an arg_list that
|
||||
// labels the positional parameters and maintains whatever other
|
||||
// tags may have been specified by the caller.
|
||||
//
|
||||
// !!!NOTE!!!
|
||||
//
|
||||
// The make_arg_list<> metafunction produces a reversed arg_list,
|
||||
// so pass the arguments to the arg_list constructor reversed in turn.
|
||||
inline ::boost::parameter::aux::empty_arg_list operator()() const
|
||||
{
|
||||
return ::boost::parameter::aux::empty_arg_list();
|
||||
}
|
||||
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PP_MIN(
|
||||
BOOST_PP_INC(BOOST_PARAMETER_MAX_ARITY)
|
||||
, BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY
|
||||
)
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z
|
||||
, (BOOST_PARAMETER_function_call_op_overload_R)(_)
|
||||
)
|
||||
#if ( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
)
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
, BOOST_PARAMETER_MAX_ARITY \
|
||||
, <boost/parameter/aux_/preprocessor/overloads.hpp> \
|
||||
))
|
||||
#include BOOST_PP_ITERATE()
|
||||
#endif
|
||||
#else // (0 == BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
template <typename A0>
|
||||
inline typename ::boost::mpl::first<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type
|
||||
>::type
|
||||
operator()(A0& a0) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type result_type;
|
||||
typedef typename ::boost::mpl::second<result>::type error;
|
||||
error();
|
||||
|
||||
return result_type(
|
||||
a0
|
||||
// , void_(), void_(), void_() ...
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, 1)
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
inline typename ::boost::mpl::first<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
, ::boost::parameter::aux::item<
|
||||
PS1,A1
|
||||
>
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type
|
||||
>::type
|
||||
operator()(A0& a0, A1& a1) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
, ::boost::parameter::aux::item<
|
||||
PS1,A1
|
||||
>
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type result_type;
|
||||
typedef typename ::boost::mpl::second<result>::type error;
|
||||
error();
|
||||
|
||||
return result_type(
|
||||
a1
|
||||
, a0
|
||||
// , void_(), void_() ...
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, 2)
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#if (2 < BOOST_PARAMETER_MAX_ARITY)
|
||||
// Higher arities are handled by the preprocessor
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,( \
|
||||
3 \
|
||||
, BOOST_PARAMETER_MAX_ARITY \
|
||||
, <boost/parameter/aux_/preprocessor/overloads.hpp> \
|
||||
))
|
||||
#include BOOST_PP_ITERATE()
|
||||
#endif
|
||||
#endif // exponential overloads
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
66
src/boost/parameter/required.hpp
Normal file
66
src/boost/parameter/required.hpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// 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 BOOST_PARAMETER_REQUIRED_HPP
|
||||
#define BOOST_PARAMETER_REQUIRED_HPP
|
||||
|
||||
#include <boost/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:
|
||||
//
|
||||
// - all keyword tags wrapped in required<...> must have a matching
|
||||
// actual argument
|
||||
//
|
||||
// - The actual argument type matched by every keyword tag
|
||||
// associated with a predicate must satisfy that predicate
|
||||
template <
|
||||
typename Tag
|
||||
, typename Predicate = ::boost::parameter::aux::use_default
|
||||
>
|
||||
struct required
|
||||
{
|
||||
typedef Tag key_type;
|
||||
typedef Predicate predicate;
|
||||
};
|
||||
}}
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T>
|
||||
struct is_required
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_false
|
||||
#else
|
||||
: ::boost::mpl::false_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Tag, typename Predicate>
|
||||
struct is_required< ::boost::parameter::required<Tag,Predicate> >
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mp11::mp_true
|
||||
#else
|
||||
: ::boost::mpl::true_
|
||||
#endif
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
87
src/boost/parameter/template_keyword.hpp
Normal file
87
src/boost/parameter/template_keyword.hpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright Daniel Wallin 2006.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// 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 BOOST_PARAMETER_TEMPLATE_KEYWORD_HPP
|
||||
#define BOOST_PARAMETER_TEMPLATE_KEYWORD_HPP
|
||||
|
||||
#include <boost/parameter/aux_/template_keyword.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename Tag, typename T>
|
||||
struct template_keyword : ::boost::parameter::aux::template_keyword_base
|
||||
{
|
||||
typedef Tag key_type;
|
||||
typedef T value_type;
|
||||
|
||||
// reference is needed for two reasons:
|
||||
//
|
||||
// 1. It is used in the body of arg_list<...>
|
||||
//
|
||||
// 2. It is the result of binding<...>, which we mistakenly told
|
||||
// people to use instead of value_type<...> to access named
|
||||
// template parameters
|
||||
//
|
||||
// It used to be that reference == value_type, but that broke when
|
||||
// the argument was a function or array type, because various
|
||||
// arg_list functions return reference.
|
||||
//
|
||||
// Simply making reference == value_type& would break all the
|
||||
// legacy code that uses binding<...> to access named template
|
||||
// parameters. -- David Abrahams
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using reference = typename ::boost::mp11::mp_eval_if<
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_function<value_type>
|
||||
, ::boost::mp11::mp_true
|
||||
, ::std::is_array<value_type>
|
||||
>
|
||||
, ::std::add_lvalue_reference<value_type>
|
||||
, ::boost::mp11::mp_identity
|
||||
, value_type
|
||||
>::type;
|
||||
#else
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_function<value_type>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::is_array<value_type>
|
||||
>::type
|
||||
, ::boost::add_lvalue_reference<value_type>
|
||||
, ::boost::mpl::identity<value_type>
|
||||
>::type reference;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#define BOOST_PARAMETER_TEMPLATE_KEYWORD(name) \
|
||||
namespace tag \
|
||||
{ \
|
||||
struct name; \
|
||||
} \
|
||||
template <typename T> \
|
||||
struct name : ::boost::parameter::template_keyword<tag::name,T> \
|
||||
{ \
|
||||
};
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
164
src/boost/parameter/value_type.hpp
Normal file
164
src/boost/parameter/value_type.hpp
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
// Copyright Daniel Wallin 2006.
|
||||
// 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 BOOST_PARAMETER_VALUE_TYPE_060921_HPP
|
||||
#define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A metafunction that, given an argument pack, returns the value type
|
||||
// of the parameter identified by the given keyword. If no such parameter
|
||||
// has been specified, returns Default
|
||||
|
||||
template <typename Parameters, typename Keyword, typename Default>
|
||||
struct value_type0
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
typename Parameters::binding
|
||||
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_false>
|
||||
>;
|
||||
|
||||
static_assert(
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, ::boost::mp11::mp_true
|
||||
>::value
|
||||
, "required parameters must not result in void_ type"
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
typedef typename ::boost::mpl::apply_wrap3<
|
||||
typename Parameters::binding
|
||||
, Keyword
|
||||
, Default
|
||||
, ::boost::mpl::false_
|
||||
>::type type;
|
||||
|
||||
BOOST_MPL_ASSERT((
|
||||
typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
));
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
};
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
template <typename Placeholder, typename Keyword, typename Default>
|
||||
struct value_type1
|
||||
{
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
Placeholder
|
||||
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_false>
|
||||
>;
|
||||
|
||||
static_assert(
|
||||
::boost::mp11::mp_if<
|
||||
::std::is_same<Default,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_if<
|
||||
::std::is_same<type,::boost::parameter::void_>
|
||||
, ::boost::mp11::mp_false
|
||||
, ::boost::mp11::mp_true
|
||||
>
|
||||
, ::boost::mp11::mp_true
|
||||
>::value
|
||||
, "required parameters must not result in void_ type"
|
||||
);
|
||||
};
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/is_placeholder.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <
|
||||
typename Parameters
|
||||
, typename Keyword
|
||||
, typename Default = ::boost::parameter::void_
|
||||
>
|
||||
struct value_type
|
||||
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
: ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_mpl_placeholder<Parameters>
|
||||
, ::boost::mpl::identity<int>
|
||||
, ::boost::parameter::value_type0<Parameters,Keyword,Default>
|
||||
>
|
||||
#endif
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = typename ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_mpl_placeholder<Parameters>
|
||||
, ::boost::mp11::mp_identity<int>
|
||||
, ::boost::mp11::mp_if<
|
||||
::boost::parameter::aux::is_mp11_placeholder<Parameters>
|
||||
, ::boost::parameter::value_type1<Parameters,Keyword,Default>
|
||||
, ::boost::parameter::value_type0<Parameters,Keyword,Default>
|
||||
>
|
||||
>::type;
|
||||
#endif
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A metafunction that, given an argument pack, returns the value type
|
||||
// of the parameter identified by the given keyword. If no such parameter
|
||||
// has been specified, returns the type returned by invoking DefaultFn
|
||||
template <typename Parameters, typename Keyword, typename DefaultFn>
|
||||
struct lazy_value_type
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
using type = ::boost::mp11::mp_apply_q<
|
||||
typename Parameters::binding
|
||||
, ::boost::mp11::mp_list<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
|
||||
, ::boost::mp11::mp_false
|
||||
>
|
||||
>;
|
||||
#else
|
||||
typedef typename ::boost::mpl::apply_wrap3<
|
||||
typename Parameters::binding
|
||||
, Keyword
|
||||
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
|
||||
, ::boost::mpl::false_
|
||||
>::type type;
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#endif // include guard
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue