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 BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
8 #define BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
10 namespace boost { namespace parameter { namespace aux {
12 struct tagged_argument_base
15 }}} // namespace boost::parameter::aux
17 #include <boost/parameter/config.hpp>
18 #include <boost/mpl/bool.hpp>
19 #include <boost/mpl/if.hpp>
21 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
22 (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
23 #include <boost/type_traits/is_base_of.hpp>
24 #include <boost/type_traits/remove_const.hpp>
25 #include <boost/type_traits/remove_reference.hpp>
27 namespace boost { namespace parameter { namespace aux {
29 // This metafunction identifies tagged_argument specializations
30 // and their derived classes.
32 struct is_tagged_argument
34 // Cannot use is_convertible<> to check if T is derived from
35 // tagged_argument_base. -- Cromwell D. Enage
37 ::boost::parameter::aux::tagged_argument_base
38 , typename ::boost::remove_const<
39 typename ::boost::remove_reference<T>::type
43 , ::boost::mpl::false_
47 }}} // namespace boost::parameter::aux
49 #else // no perfect forwarding support and no exponential overloads
50 #include <boost/type_traits/is_convertible.hpp>
51 #include <boost/type_traits/is_lvalue_reference.hpp>
53 namespace boost { namespace parameter { namespace aux {
56 struct is_tagged_argument_aux
57 : ::boost::is_convertible<
59 , ::boost::parameter::aux::tagged_argument_base const*
64 // This metafunction identifies tagged_argument specializations
65 // and their derived classes.
67 struct is_tagged_argument
69 ::boost::is_lvalue_reference<T>
70 , ::boost::mpl::false_
71 , ::boost::parameter::aux::is_tagged_argument_aux<T>
75 }}} // namespace boost::parameter::aux
77 #endif // perfect forwarding support, or exponential overloads
79 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
80 #include <type_traits>
82 namespace boost { namespace parameter { namespace aux {
85 using is_tagged_argument_mp11 = ::std::is_base_of<
86 ::boost::parameter::aux::tagged_argument_base
87 , typename ::std::remove_const<
88 typename ::std::remove_reference<T>::type
91 }}} // namespace boost::parameter::aux
93 #endif // BOOST_PARAMETER_CAN_USE_MP11
94 #endif // include guard