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)
6
7#ifndef BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
8#define BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
9
10namespace boost { namespace parameter { namespace aux {
11
12 struct tagged_argument_base
13 {
14 };
15}}} // namespace boost::parameter::aux
16
17#include <boost/parameter/config.hpp>
18#include <boost/mpl/bool.hpp>
19#include <boost/mpl/if.hpp>
20
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>
26
27namespace boost { namespace parameter { namespace aux {
28
29 // This metafunction identifies tagged_argument specializations
30 // and their derived classes.
31 template <typename T>
32 struct is_tagged_argument
33 : ::boost::mpl::if_<
34 // Cannot use is_convertible<> to check if T is derived from
35 // tagged_argument_base. -- Cromwell D. Enage
36 ::boost::is_base_of<
37 ::boost::parameter::aux::tagged_argument_base
38 , typename ::boost::remove_const<
39 typename ::boost::remove_reference<T>::type
40 >::type
41 >
42 , ::boost::mpl::true_
43 , ::boost::mpl::false_
44 >::type
45 {
46 };
47}}} // namespace boost::parameter::aux
48
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>
52
53namespace boost { namespace parameter { namespace aux {
54
55 template <typename T>
56 struct is_tagged_argument_aux
57 : ::boost::is_convertible<
58 T*
59 , ::boost::parameter::aux::tagged_argument_base const*
60 >
61 {
62 };
63
64 // This metafunction identifies tagged_argument specializations
65 // and their derived classes.
66 template <typename T>
67 struct is_tagged_argument
68 : ::boost::mpl::if_<
69 ::boost::is_lvalue_reference<T>
70 , ::boost::mpl::false_
71 , ::boost::parameter::aux::is_tagged_argument_aux<T>
72 >::type
73 {
74 };
75}}} // namespace boost::parameter::aux
76
77#endif // perfect forwarding support, or exponential overloads
78
79#if defined(BOOST_PARAMETER_CAN_USE_MP11)
80#include <type_traits>
81
82namespace boost { namespace parameter { namespace aux {
83
84 template <typename T>
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
89 >::type
90 >;
91}}} // namespace boost::parameter::aux
92
93#endif // BOOST_PARAMETER_CAN_USE_MP11
94#endif // include guard
95
96

source code of boost/libs/parameter/include/boost/parameter/aux_/is_tagged_argument.hpp