123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894 |
- // 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 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(__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
|