1 // Copyright Daniel Wallin, David Abrahams 2005.
2 // Copyright Cromwell D. Enage 2017.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef ARG_LIST_050329_HPP
8 #define ARG_LIST_050329_HPP
10 namespace boost { namespace parameter { namespace aux {
13 // Structures used to build the tuple of actual arguments. The tuple is a
14 // nested cons-style list of arg_list specializations terminated by an
17 // Each specialization of arg_list is derived from its successor in the
18 // list type. This feature is used along with using declarations to build
19 // member function overload sets that can match against keywords.
22 // MPL sequence support
28 typedef typename T::reference type;
30 }}} // namespace boost::parameter::aux
32 #include <boost/parameter/config.hpp>
34 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
36 namespace boost { namespace parameter { namespace aux {
38 struct value_type_is_void
42 struct value_type_is_not_void
45 }}} // namespace boost::parameter::aux
49 #include <boost/parameter/aux_/void.hpp>
50 #include <boost/parameter/aux_/yesno.hpp>
51 #include <boost/parameter/aux_/result_of0.hpp>
52 #include <boost/parameter/aux_/default.hpp>
54 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
57 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
58 #include <boost/mp11/integral.hpp>
59 #include <boost/mp11/list.hpp>
60 #include <boost/mp11/utility.hpp>
61 #include <type_traits>
64 namespace boost { namespace parameter { namespace aux {
66 // Terminates arg_list<> and represents an empty list. Since this is just
67 // the terminating case, you might want to look at arg_list first to get a
68 // feel for what's really happening here.
73 typedef ::boost::parameter::void_ value_type;
76 // Variadic constructor also serves as default constructor.
77 template <typename ...Args>
78 inline BOOST_CONSTEXPR empty_arg_list(Args&&...)
82 // A metafunction class that, given a keyword and a default type,
83 // returns the appropriate result type for a keyword lookup given
87 template <typename KW, typename Default, typename Reference>
93 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
94 template <typename KW, typename Default, typename Reference>
99 // Terminator for has_key, indicating that the keyword is unique.
100 template <typename KW>
101 static ::boost::parameter::aux::no_tag has_key(KW*);
103 // If either of these operators are called, it means there is no
104 // argument in the list that matches the supplied keyword. Just
105 // return the default value.
106 template <typename K, typename Default>
107 inline BOOST_CONSTEXPR Default&
108 operator[](::boost::parameter::aux::default_<K,Default> x) const
113 template <typename K, typename Default>
114 inline BOOST_CONSTEXPR Default&&
115 operator[](::boost::parameter::aux::default_r_<K,Default> x) const
117 return ::std::forward<Default>(x.value);
120 // If this operator is called, it means there is no argument in the
121 // list that matches the supplied keyword. Just evaluate and return
122 // the default value.
123 template <typename K, typename F>
124 inline BOOST_CONSTEXPR
125 typename ::boost::parameter::aux::result_of0<F>::type
126 operator[](BOOST_PARAMETER_lazy_default_fallback<K,F> x) const
128 return x.compute_default();
131 // No argument corresponding to ParameterRequirements::key_type
132 // was found if we match this overload, so unless that parameter
133 // has a default, we indicate that the actual arguments don't
134 // match the function's requirements.
135 template <typename ParameterRequirements, typename ArgPack>
136 static typename ParameterRequirements::has_default
137 satisfies(ParameterRequirements*, ArgPack*);
139 // MPL sequence support
140 typedef ::boost::parameter::aux::empty_arg_list type; // convenience
141 // For dispatching to sequence intrinsics
142 typedef ::boost::parameter::aux::arg_list_tag tag;
144 }}} // namespace boost::parameter::aux
146 #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
147 #include <boost/parameter/aux_/yesno.hpp>
148 #include <boost/parameter/aux_/is_maybe.hpp>
149 #include <boost/parameter/aux_/tagged_argument_fwd.hpp>
150 #include <boost/parameter/aux_/parameter_requirements.hpp>
151 #include <boost/parameter/aux_/augment_predicate.hpp>
152 #include <boost/parameter/keyword_fwd.hpp>
153 #include <boost/mpl/bool.hpp>
154 #include <boost/mpl/if.hpp>
155 #include <boost/mpl/eval_if.hpp>
156 #include <boost/mpl/apply_wrap.hpp>
157 #include <boost/mpl/assert.hpp>
158 #include <boost/type_traits/is_same.hpp>
159 #include <boost/core/enable_if.hpp>
161 namespace boost { namespace parameter { namespace aux {
163 // A tuple of tagged arguments, terminated with empty_arg_list. Every
164 // TaggedArg is an instance of tagged_argument<> or
165 // tagged_argument_rref<>.
168 , typename Next = ::boost::parameter::aux::empty_arg_list
169 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
170 , typename EmitsErrors = ::boost::mp11::mp_true
172 , typename EmitsErrors = ::boost::mpl::true_
175 class arg_list : public Next
177 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
178 using _holds_maybe = typename ::boost::parameter::aux
179 ::is_maybe<typename TaggedArg::value_type>::type;
181 typedef typename ::boost::parameter::aux
182 ::is_maybe<typename TaggedArg::value_type>::type _holds_maybe;
185 TaggedArg arg; // Stores the argument
188 typedef TaggedArg tagged_arg;
189 typedef ::boost::parameter::aux::arg_list<TaggedArg,Next> self;
190 typedef typename TaggedArg::key_type key_type;
192 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
193 using reference = typename ::boost::mp11::mp_if<
195 , ::boost::parameter::aux
196 ::get_reference<typename TaggedArg::value_type>
197 , ::boost::parameter::aux::get_reference<TaggedArg>
200 using value_type = ::boost::mp11
201 ::mp_if<_holds_maybe,reference,typename TaggedArg::value_type>;
202 #else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
203 typedef typename ::boost::mpl::eval_if<
205 , ::boost::parameter::aux
206 ::get_reference<typename TaggedArg::value_type>
207 , ::boost::parameter::aux::get_reference<TaggedArg>
210 typedef typename ::boost::mpl::if_<
213 , typename TaggedArg::value_type
215 #endif // BOOST_PARAMETER_CAN_USE_MP11
217 // Create a new list by prepending arg to a copy of tail. Used when
218 // incrementally building this structure with the comma operator.
219 inline BOOST_CONSTEXPR arg_list(
220 TaggedArg const& head
222 ) : Next(tail), arg(head)
226 // Store the arguments in successive nodes of this list.
227 // Use tag dispatching to determine whether to forward all arguments
228 // to the Next constructor, or store the first argument and forward
229 // the rest. -- Cromwell D. Enage
230 template <typename A0>
231 inline BOOST_CONSTEXPR arg_list(
232 ::boost::parameter::aux::value_type_is_not_void
235 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
236 ::boost::mp11::mp_if<
239 typename ::boost::mpl::if_<
242 typename Next::tagged_arg::value_type
243 , ::boost::parameter::void_
245 , ::boost::parameter::aux::value_type_is_void
246 , ::boost::parameter::aux::value_type_is_not_void
247 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
253 , arg(::std::forward<A0>(a0))
257 template <typename ...Args>
258 inline BOOST_CONSTEXPR arg_list(
259 ::boost::parameter::aux::value_type_is_void
262 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
263 ::boost::mp11::mp_if<
266 typename ::boost::mpl::if_<
269 typename Next::tagged_arg::value_type
270 , ::boost::parameter::void_
272 , ::boost::parameter::aux::value_type_is_void
273 , ::boost::parameter::aux::value_type_is_not_void
274 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
279 , ::std::forward<Args>(args)...
281 , arg(::boost::parameter::aux::void_reference())
285 template <typename A0, typename A1, typename ...Args>
286 inline BOOST_CONSTEXPR arg_list(
287 ::boost::parameter::aux::value_type_is_not_void
292 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
293 ::boost::mp11::mp_if<
296 typename ::boost::mpl::if_<
299 typename Next::tagged_arg::value_type
300 , ::boost::parameter::void_
302 , ::boost::parameter::aux::value_type_is_void
303 , ::boost::parameter::aux::value_type_is_not_void
304 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
309 , ::std::forward<A1>(a1)
310 , ::std::forward<Args>(args)...
312 , arg(::std::forward<A0>(a0))
316 // A metafunction class that, given a keyword and a default type,
317 // returns the appropriate result type for a keyword lookup given
321 typedef typename Next::binding next_binding;
323 template <typename KW, typename Default, typename Reference>
326 typedef typename ::boost::mpl::eval_if<
327 ::boost::is_same<KW,key_type>
328 , ::boost::mpl::if_<Reference,reference,value_type>
330 ::apply_wrap3<next_binding,KW,Default,Reference>
334 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
335 template <typename KW, typename Default, typename Reference>
336 using fn = ::boost::mp11::mp_if<
337 ::std::is_same<KW,key_type>
338 , ::boost::mp11::mp_if<Reference,reference,value_type>
339 , ::boost::mp11::mp_apply_q<
341 , ::boost::mp11::mp_list<KW,Default,Reference>
347 // Overload for key_type, so the assert below will fire
348 // if the same keyword is used again.
349 static ::boost::parameter::aux::yes_tag has_key(key_type*);
353 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
354 using _has_unique_key = ::boost::mp11::mp_bool<
356 typedef ::boost::mpl::bool_<
360 static_cast<key_type*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
362 ) == sizeof(::boost::parameter::aux::no_tag)
363 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
369 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
371 !(EmitsErrors::value) || (_has_unique_key::value)
372 , "duplicate keyword"
375 BOOST_MPL_ASSERT_MSG(
376 !(EmitsErrors::value) || (_has_unique_key::value)
383 // Begin implementation of indexing operators
384 // for looking up specific arguments by name.
387 // Helpers that handle the case when TaggedArg is empty<T>.
388 template <typename D>
389 inline BOOST_CONSTEXPR reference
390 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
391 get_default(D const&, ::boost::mp11::mp_false) const
393 get_default(D const&, ::boost::mpl::false_) const
396 return this->arg.get_value();
399 template <typename D>
400 inline BOOST_CONSTEXPR reference
401 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
402 get_default(D const& d, ::boost::mp11::mp_true) const
404 get_default(D const& d, ::boost::mpl::true_) const
408 this->arg.get_value()
409 ? this->arg.get_value().get()
410 : this->arg.get_value().construct(d.value)
415 inline BOOST_CONSTEXPR reference
416 operator[](::boost::parameter::keyword<key_type> const&) const
418 #if !defined(BOOST_NO_CXX14_CONSTEXPR)
419 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
420 static_assert(!_holds_maybe::value, "must not hold maybe");
422 BOOST_WORKAROUND(BOOST_GCC, >= 40700) && \
423 BOOST_WORKAROUND(BOOST_GCC, < 40900) \
424 ) && !BOOST_WORKAROUND(BOOST_GCC, >= 50000) && \
425 !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
426 BOOST_MPL_ASSERT_NOT((_holds_maybe));
429 return this->arg.get_value();
432 template <typename Default>
433 inline BOOST_CONSTEXPR reference
435 ::boost::parameter::aux::default_<key_type,Default> const& d
438 return this->get_default(d, _holds_maybe());
441 template <typename Default>
442 inline BOOST_CONSTEXPR reference
444 ::boost::parameter::aux::default_r_<key_type,Default> const& d
447 return this->get_default(d, _holds_maybe());
450 template <typename Default>
451 inline BOOST_CONSTEXPR reference
453 BOOST_PARAMETER_lazy_default_fallback<key_type,Default> const&
456 #if !defined(BOOST_NO_CXX14_CONSTEXPR)
457 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
458 static_assert(!_holds_maybe::value, "must not hold maybe");
460 BOOST_WORKAROUND(BOOST_GCC, >= 40700) && \
461 BOOST_WORKAROUND(BOOST_GCC, < 40900) \
462 ) && !BOOST_WORKAROUND(BOOST_GCC, >= 50000) && \
463 !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
464 BOOST_MPL_ASSERT_NOT((_holds_maybe));
467 return this->arg.get_value();
470 // Builds an overload set including operator[]s defined
472 using Next::operator[];
475 // End of indexing support
478 // For parameter_requirements matching this node's key_type, return
479 // a bool constant wrapper indicating whether the requirements are
480 // satisfied by TaggedArg. Used only for compile-time computation
481 // and never really called, so a declaration is enough.
482 template <typename HasDefault, typename Predicate, typename ArgPack>
483 static typename ::boost::lazy_enable_if<
484 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
485 ::boost::mp11::mp_if<
487 , ::boost::mp11::mp_true
490 , ::boost::parameter::aux::augment_predicate_mp11<
492 typename ::boost::mpl::if_<
494 , ::boost::mpl::true_
497 , ::boost::parameter::aux::augment_predicate<
507 ::boost::parameter::aux::parameter_requirements<
515 // Builds an overload set including satisfies functions defined
517 using Next::satisfies;
519 // Comma operator to compose argument list without using parameters<>.
520 // Useful for argument lists with undetermined length.
521 template <typename KW, typename T2>
522 inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
523 ::boost::parameter::aux::tagged_argument<KW,T2>
527 ::boost::parameter::aux::tagged_argument<KW,T2> const& x
530 return ::boost::parameter::aux::arg_list<
531 ::boost::parameter::aux::tagged_argument<KW,T2>
536 template <typename KW, typename T2>
537 inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
538 ::boost::parameter::aux::tagged_argument_rref<KW,T2>
542 ::boost::parameter::aux::tagged_argument_rref<KW,T2> const& x
545 return ::boost::parameter::aux::arg_list<
546 ::boost::parameter::aux::tagged_argument_rref<KW,T2>
551 // MPL sequence support
552 typedef self type; // Convenience for users
553 typedef Next tail_type; // For the benefit of iterators
554 // For dispatching to sequence intrinsics
555 typedef ::boost::parameter::aux::arg_list_tag tag;
557 }}} // namespace boost::parameter::aux
559 #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
561 #include <boost/preprocessor/repetition/enum_params.hpp>
562 #include <boost/preprocessor/facilities/intercept.hpp>
564 namespace boost { namespace parameter { namespace aux {
566 // Terminates arg_list<> and represents an empty list. Since this is just
567 // the terminating case, you might want to look at arg_list first to get a
568 // feel for what's really happening here.
569 struct empty_arg_list
571 inline BOOST_CONSTEXPR empty_arg_list()
575 // Constructor taking BOOST_PARAMETER_COMPOSE_MAX_ARITY empty_arg_list
576 // arguments; this makes initialization.
577 inline BOOST_CONSTEXPR empty_arg_list(
578 BOOST_PP_ENUM_PARAMS(
579 BOOST_PARAMETER_COMPOSE_MAX_ARITY
580 , ::boost::parameter::void_ BOOST_PP_INTERCEPT
586 // A metafunction class that, given a keyword and a default type,
587 // returns the appropriate result type for a keyword lookup given
591 template <typename KW, typename Default, typename Reference>
594 typedef Default type;
598 // Terminator for has_key, indicating that the keyword is unique.
599 template <typename KW>
600 static ::boost::parameter::aux::no_tag has_key(KW*);
602 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
603 // The overload set technique doesn't work with these older compilers,
604 // so they need some explicit handholding.
606 // A metafunction class that, given a keyword, returns the type of the
607 // base sublist whose get() function can produce the value for that key.
610 template <typename KW>
613 typedef ::boost::parameter::aux::empty_arg_list type;
616 #endif // Borland workarounds needed
618 // If either of these operators are called, it means there is no
619 // argument in the list that matches the supplied keyword. Just
620 // return the default value.
621 template <typename K, typename Default>
622 inline BOOST_CONSTEXPR Default&
623 operator[](::boost::parameter::aux::default_<K,Default> x) const
628 // If this operator is called, it means there is no argument in the
629 // list that matches the supplied keyword. Just evaluate and return
630 // the default value.
631 template <typename K, typename F>
632 inline BOOST_CONSTEXPR
633 typename ::boost::parameter::aux::result_of0<F>::type
634 operator[](BOOST_PARAMETER_lazy_default_fallback<K,F> x) const
636 return x.compute_default();
639 // No argument corresponding to ParameterRequirements::key_type
640 // was found if we match this overload, so unless that parameter
641 // has a default, we indicate that the actual arguments don't
642 // match the function's requirements.
643 template <typename ParameterRequirements, typename ArgPack>
644 static typename ParameterRequirements::has_default
645 satisfies(ParameterRequirements*, ArgPack*);
647 // MPL sequence support
648 typedef ::boost::parameter::aux::empty_arg_list type; // convenience
649 // For dispatching to sequence intrinsics
650 typedef ::boost::parameter::aux::arg_list_tag tag;
652 }}} // namespace boost::parameter::aux
654 #include <boost/parameter/aux_/yesno.hpp>
655 #include <boost/parameter/aux_/is_maybe.hpp>
656 #include <boost/parameter/aux_/tagged_argument_fwd.hpp>
657 #include <boost/parameter/aux_/parameter_requirements.hpp>
658 #include <boost/parameter/aux_/augment_predicate.hpp>
659 #include <boost/parameter/keyword_fwd.hpp>
660 #include <boost/mpl/bool.hpp>
661 #include <boost/mpl/if.hpp>
662 #include <boost/mpl/eval_if.hpp>
663 #include <boost/mpl/apply_wrap.hpp>
664 #include <boost/mpl/assert.hpp>
665 #include <boost/type_traits/is_same.hpp>
666 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
667 #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
669 #if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
670 #include <boost/core/enable_if.hpp>
673 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
674 #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
677 namespace boost { namespace parameter { namespace aux {
679 // A tuple of tagged arguments, terminated with empty_arg_list. Every
680 // TaggedArg is an instance of tagged_argument<>.
683 , typename Next = ::boost::parameter::aux::empty_arg_list
684 , typename EmitsErrors = ::boost::mpl::true_
686 class arg_list : public Next
688 typedef typename ::boost::parameter::aux
689 ::is_maybe<typename TaggedArg::value_type>::type _holds_maybe;
691 TaggedArg arg; // Stores the argument
694 typedef TaggedArg tagged_arg;
695 typedef ::boost::parameter::aux::arg_list<TaggedArg,Next> self;
696 typedef typename TaggedArg::key_type key_type;
698 typedef typename ::boost::mpl::eval_if<
700 , ::boost::parameter::aux
701 ::get_reference<typename TaggedArg::value_type>
702 , ::boost::parameter::aux::get_reference<TaggedArg>
705 typedef typename ::boost::mpl::if_<
708 , typename TaggedArg::value_type
711 // Create a new list by prepending arg to a copy of tail. Used when
712 // incrementally building this structure with the comma operator.
713 inline BOOST_CONSTEXPR arg_list(
714 TaggedArg const& head
716 ) : Next(tail), arg(head)
720 // Store the arguments in successive nodes of this list.
722 // typename A0, typename A1, ...
723 BOOST_PP_ENUM_PARAMS(
724 BOOST_PARAMETER_COMPOSE_MAX_ARITY
728 inline BOOST_CONSTEXPR arg_list(
729 // A0& a0, A1& a1, ...
730 BOOST_PP_ENUM_BINARY_PARAMS(
731 BOOST_PARAMETER_COMPOSE_MAX_ARITY
737 BOOST_PP_ENUM_SHIFTED_PARAMS(
738 BOOST_PARAMETER_COMPOSE_MAX_ARITY
741 , ::boost::parameter::aux::void_reference()
747 // A metafunction class that, given a keyword and a default type,
748 // returns the appropriate result type for a keyword lookup given
752 typedef typename Next::binding next_binding;
754 template <typename KW, typename Default, typename Reference>
757 typedef typename ::boost::mpl::eval_if<
758 ::boost::is_same<KW,key_type>
759 , ::boost::mpl::if_<Reference,reference,value_type>
760 , ::boost::mpl::apply_wrap3<
770 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
771 // Overload for key_type, so the assert below will fire
772 // if the same keyword is used again.
773 static ::boost::parameter::aux::yes_tag has_key(key_type*);
777 #if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(BOOST_MSVC, < 1800)
778 BOOST_MPL_ASSERT_MSG(
781 static_cast<key_type*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
783 ) == sizeof(::boost::parameter::aux::no_tag)
788 typedef ::boost::mpl::bool_<
791 static_cast<key_type*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
793 ) == sizeof(::boost::parameter::aux::no_tag)
796 BOOST_MPL_ASSERT_MSG(
797 !(EmitsErrors::value) || (_has_unique_key::value)
801 #endif // SFINAE/MSVC workarounds needed
802 #endif // Borland workarounds not needed
806 // Begin implementation of indexing operators
807 // for looking up specific arguments by name.
810 // Helpers that handle the case when TaggedArg is empty<T>.
811 template <typename D>
812 inline BOOST_CONSTEXPR reference
813 get_default(D const&, ::boost::mpl::false_) const
815 return this->arg.get_value();
818 template <typename D>
819 inline BOOST_CONSTEXPR reference
820 get_default(D const& d, ::boost::mpl::true_) const
823 this->arg.get_value()
824 ? this->arg.get_value().get()
825 : this->arg.get_value().construct(d.value)
830 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
831 // These older compilers don't support the overload set creation
832 // idiom well, so we need to do all the return type calculation
833 // for the compiler and dispatch through an outer function template.
835 // A metafunction class that, given a keyword, returns the base
836 // sublist whose get() function can produce the value for that key.
839 typedef typename Next::key_owner next_key_owner;
841 template <typename KW>
844 typedef typename ::boost::mpl::eval_if<
845 ::boost::is_same<KW,key_type>
846 , ::boost::mpl::identity<
847 ::boost::parameter::aux::arg_list<TaggedArg,Next>
849 , ::boost::mpl::apply_wrap1<next_key_owner,KW>
854 // Outer indexing operators that dispatch to the right node's
856 template <typename KW>
857 inline BOOST_CONSTEXPR typename ::boost::mpl::apply_wrap3<
860 , ::boost::parameter::void_
861 , ::boost::mpl::true_
863 operator[](::boost::parameter::keyword<KW> const& x) const
865 typename ::boost::mpl::apply_wrap1<key_owner,KW>::type const&
867 return sublist.get(x);
870 template <typename KW, typename Default>
871 inline BOOST_CONSTEXPR typename ::boost::mpl::apply_wrap3<
875 , ::boost::mpl::true_
878 ::boost::parameter::aux::default_<KW,Default> const& x
881 typename ::boost::mpl::apply_wrap1<key_owner,KW>::type const&
883 return sublist.get(x);
886 template <typename KW, typename F>
887 inline BOOST_CONSTEXPR typename ::boost::mpl::apply_wrap3<
890 , typename ::boost::parameter::aux::result_of0<F>::type
891 , ::boost::mpl::true_
894 BOOST_PARAMETER_lazy_default_fallback<KW,F> const& x
897 typename ::boost::mpl::apply_wrap1<key_owner,KW>::type const&
899 return sublist.get(x);
902 // These just return the stored value; when empty_arg_list is reached,
903 // indicating no matching argument was passed, the default is
904 // returned, or if no default_ or lazy_default was passed, compilation
906 inline BOOST_CONSTEXPR reference
907 get(::boost::parameter::keyword<key_type> const&) const
909 BOOST_MPL_ASSERT_NOT((_holds_maybe));
910 return this->arg.get_value();
913 template <typename Default>
914 inline BOOST_CONSTEXPR reference
916 ::boost::parameter::aux::default_<key_type,Default> const& d
919 return this->get_default(d, _holds_maybe());
922 template <typename Default>
923 inline BOOST_CONSTEXPR reference
925 BOOST_PARAMETER_lazy_default_fallback<key_type,Default> const&
928 return this->arg.get_value();
930 #else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
931 inline BOOST_CONSTEXPR reference
932 operator[](::boost::parameter::keyword<key_type> const&) const
934 BOOST_MPL_ASSERT_NOT((_holds_maybe));
935 return this->arg.get_value();
938 template <typename Default>
939 inline BOOST_CONSTEXPR reference
941 ::boost::parameter::aux::default_<key_type,Default> const& d
944 return this->get_default(d, _holds_maybe());
947 template <typename Default>
948 inline BOOST_CONSTEXPR reference
950 BOOST_PARAMETER_lazy_default_fallback<key_type,Default> const&
953 BOOST_MPL_ASSERT_NOT((_holds_maybe));
954 return this->arg.get_value();
957 // Builds an overload set including operator[]s defined
959 using Next::operator[];
962 // End of indexing support
965 // For parameter_requirements matching this node's key_type, return
966 // a bool constant wrapper indicating whether the requirements are
967 // satisfied by TaggedArg. Used only for compile-time computation
968 // and never really called, so a declaration is enough.
969 template <typename HasDefault, typename Predicate, typename ArgPack>
971 #if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
972 ::boost::lazy_enable_if<
973 typename ::boost::mpl::if_<
975 , ::boost::mpl::true_
979 ::boost::parameter::aux::augment_predicate<
985 #if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
990 ::boost::parameter::aux::parameter_requirements<
998 // Builds an overload set including satisfies functions defined
1000 using Next::satisfies;
1001 #endif // Borland workarounds needed
1003 // Comma operator to compose argument list without using parameters<>.
1004 // Useful for argument lists with undetermined length.
1005 template <typename KW, typename T2>
1006 inline BOOST_CONSTEXPR ::boost::parameter::aux::arg_list<
1007 ::boost::parameter::aux::tagged_argument<KW,T2>
1011 ::boost::parameter::aux::tagged_argument<KW,T2> const& x
1014 return ::boost::parameter::aux::arg_list<
1015 ::boost::parameter::aux::tagged_argument<KW,T2>
1020 // MPL sequence support
1021 typedef self type; // Convenience for users
1022 typedef Next tail_type; // For the benefit of iterators
1023 // For dispatching to sequence intrinsics
1024 typedef ::boost::parameter::aux::arg_list_tag tag;
1026 }}} // namespace boost::parameter::aux
1028 #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
1030 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
1032 namespace boost { namespace parameter { namespace aux {
1034 template <typename ...ArgTuples>
1035 struct arg_list_cons;
1038 struct arg_list_cons<>
1040 using type = ::boost::parameter::aux::empty_arg_list;
1043 template <typename ArgTuple0, typename ...Tuples>
1044 struct arg_list_cons<ArgTuple0,Tuples...>
1046 using type = ::boost::parameter::aux::arg_list<
1047 typename ArgTuple0::tagged_arg
1048 , typename ::boost::parameter::aux::arg_list_cons<Tuples...>::type
1049 , typename ArgTuple0::emits_errors
1055 , typename TaggedArg
1056 , typename EmitsErrors = ::boost::mp11::mp_true
1058 struct flat_like_arg_tuple
1060 using tagged_arg = TaggedArg;
1061 using emits_errors = EmitsErrors;
1064 template <typename ...ArgTuples>
1065 class flat_like_arg_list
1066 : public ::boost::parameter::aux::arg_list_cons<ArgTuples...>::type
1068 using _base_type = typename ::boost::parameter::aux
1069 ::arg_list_cons<ArgTuples...>::type;
1072 inline BOOST_CONSTEXPR flat_like_arg_list(
1073 typename _base_type::tagged_arg const& head
1074 , typename _base_type::tail_type const& tail
1075 ) : _base_type(head, tail)
1079 template <typename ...Args>
1080 inline BOOST_CONSTEXPR flat_like_arg_list(Args&&... args)
1081 : _base_type(::std::forward<Args>(args)...)
1085 using _base_type::operator[];
1086 using _base_type::satisfies;
1088 // Comma operator to compose argument list without using parameters<>.
1089 // Useful for argument lists with undetermined length.
1090 template <typename TaggedArg>
1091 inline BOOST_CONSTEXPR ::boost::parameter::aux::flat_like_arg_list<
1092 ::boost::parameter::aux::flat_like_arg_tuple<
1093 typename TaggedArg::base_type::key_type
1094 , typename TaggedArg::base_type
1098 operator,(TaggedArg const& x) const
1100 return ::boost::parameter::aux::flat_like_arg_list<
1101 ::boost::parameter::aux::flat_like_arg_tuple<
1102 typename TaggedArg::base_type::key_type
1103 , typename TaggedArg::base_type
1107 static_cast<typename TaggedArg::base_type const&>(x)
1108 , static_cast<_base_type const&>(*this)
1114 class flat_like_arg_list<>
1115 : public ::boost::parameter::aux::empty_arg_list
1117 using _base_type = ::boost::parameter::aux::empty_arg_list;
1120 template <typename ...Args>
1121 inline BOOST_CONSTEXPR flat_like_arg_list(Args&&... args)
1122 : _base_type(::std::forward<Args>(args)...)
1126 using _base_type::operator[];
1127 using _base_type::satisfies;
1129 // Comma operator to compose argument list without using parameters<>.
1130 // Useful for argument lists with undetermined length.
1131 template <typename TaggedArg>
1132 inline BOOST_CONSTEXPR ::boost::parameter::aux::flat_like_arg_list<
1133 ::boost::parameter::aux::flat_like_arg_tuple<
1134 typename TaggedArg::base_type::key_type
1135 , typename TaggedArg::base_type
1138 operator,(TaggedArg const& x) const
1140 return ::boost::parameter::aux::flat_like_arg_list<
1141 ::boost::parameter::aux::flat_like_arg_tuple<
1142 typename TaggedArg::base_type::key_type
1143 , typename TaggedArg::base_type
1146 static_cast<typename TaggedArg::base_type const&>(x)
1147 , static_cast<_base_type const&>(*this)
1151 }}} // namespace boost::parameter::aux
1153 #endif // BOOST_PARAMETER_CAN_USE_MP11
1155 #include <boost/mpl/iterator_tags.hpp>
1157 namespace boost { namespace parameter { namespace aux {
1159 // MPL sequence support
1160 template <typename ArgumentPack>
1161 struct arg_list_iterator
1163 typedef ::boost::mpl::forward_iterator_tag category;
1165 // The incremented iterator
1166 typedef ::boost::parameter::aux
1167 ::arg_list_iterator<typename ArgumentPack::tail_type> next;
1169 // dereferencing yields the key type
1170 typedef typename ArgumentPack::key_type type;
1174 struct arg_list_iterator< ::boost::parameter::aux::empty_arg_list>
1177 }}} // namespace boost::parameter::aux
1179 #include <boost/mpl/begin_end_fwd.hpp>
1181 // MPL sequence support
1182 namespace boost { namespace mpl {
1185 struct begin_impl< ::boost::parameter::aux::arg_list_tag>
1187 template <typename S>
1190 typedef ::boost::parameter::aux::arg_list_iterator<S> type;
1195 struct end_impl< ::boost::parameter::aux::arg_list_tag>
1200 typedef ::boost::parameter::aux::arg_list_iterator<
1201 ::boost::parameter::aux::empty_arg_list
1205 }} // namespace boost::mpl
1207 #include <boost/parameter/value_type.hpp>
1208 #include <boost/mpl/has_key_fwd.hpp>
1209 #include <boost/type_traits/is_void.hpp>
1211 namespace boost { namespace mpl {
1214 struct has_key_impl< ::boost::parameter::aux::arg_list_tag>
1216 template <typename ArgList, typename Keyword>
1219 typedef typename ::boost::mpl::if_<
1221 typename ::boost::parameter
1222 ::value_type<ArgList,Keyword,void>::type
1224 , ::boost::mpl::false_
1225 , ::boost::mpl::true_
1229 }} // namespace boost::mpl
1231 #include <boost/mpl/count_fwd.hpp>
1232 #include <boost/mpl/int.hpp>
1234 namespace boost { namespace mpl {
1237 struct count_impl< ::boost::parameter::aux::arg_list_tag>
1239 template <typename ArgList, typename Keyword>
1242 typedef typename ::boost::mpl::if_<
1244 typename ::boost::parameter
1245 ::value_type<ArgList,Keyword,void>::type
1247 , ::boost::mpl::int_<0>
1248 , ::boost::mpl::int_<1>
1252 }} // namespace boost::mpl
1254 #include <boost/mpl/key_type_fwd.hpp>
1255 #include <boost/mpl/identity.hpp>
1257 namespace boost { namespace mpl {
1260 struct key_type_impl< ::boost::parameter::aux::arg_list_tag>
1262 template <typename ArgList, typename Keyword>
1265 typedef typename ::boost::mpl::eval_if<
1267 typename ::boost::parameter
1268 ::value_type<ArgList,Keyword,void>::type
1271 , ::boost::mpl::identity<Keyword>
1275 }} // namespace boost::mpl
1277 #include <boost/mpl/value_type_fwd.hpp>
1279 namespace boost { namespace mpl {
1282 struct value_type_impl< ::boost::parameter::aux::arg_list_tag>
1283 : ::boost::mpl::key_type_impl< ::boost::parameter::aux::arg_list_tag>
1286 }} // namespace boost::mpl
1288 #include <boost/mpl/at_fwd.hpp>
1290 namespace boost { namespace mpl {
1293 struct at_impl< ::boost::parameter::aux::arg_list_tag>
1294 : ::boost::mpl::key_type_impl< ::boost::parameter::aux::arg_list_tag>
1297 }} // namespace boost::mpl
1299 #include <boost/mpl/order_fwd.hpp>
1300 #include <boost/mpl/void.hpp>
1301 #include <boost/mpl/find.hpp>
1302 #include <boost/mpl/distance.hpp>
1304 namespace boost { namespace mpl {
1307 struct order_impl< ::boost::parameter::aux::arg_list_tag>
1309 template <typename ArgList, typename Keyword>
1312 typedef typename ::boost::mpl::find<ArgList,Keyword>::type Itr;
1313 typedef typename ::boost::mpl::eval_if<
1315 typename ::boost::parameter
1316 ::value_type<ArgList,Keyword,void>::type
1318 , ::boost::mpl::identity< ::boost::mpl::void_>
1319 , ::boost::mpl::distance<
1321 , ::boost::parameter::aux::arg_list_iterator<
1322 ::boost::parameter::aux::empty_arg_list
1328 }} // namespace boost::mpl
1330 #endif // include guard