-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnested_keyword.hpp
111 lines (104 loc) · 7.04 KB
/
nested_keyword.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright Eric Niebler 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_NESTED_KEYWORD_HPP
#define BOOST_PARAMETER_NESTED_KEYWORD_HPP
#include <boost/parameter/aux_/name.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/config.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_NESTED_KEYWORD_AUX(tag_namespace, q, name, alias) \
namespace tag_namespace \
{ \
template <int Dummy = 0> \
struct BOOST_PP_CAT(name, _) \
{ \
static BOOST_CONSTEXPR char const* keyword_name() \
{ \
return BOOST_PP_STRINGIZE(name); \
} \
using _ = BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE( \
BOOST_PP_CAT(name, _)<Dummy> \
); \
using _1 = BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE( \
BOOST_PP_CAT(name, _)<Dummy> \
); \
BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_BINDING( \
binding_fn \
, BOOST_PP_CAT(name, _)<Dummy> \
); \
BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_VALUE( \
fn \
, BOOST_PP_CAT(name, _)<Dummy> \
); \
using qualifier = ::boost::parameter::q; \
static ::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
> const& alias; \
}; \
template <int Dummy> \
::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
> const& BOOST_PP_CAT(name, _)<Dummy>::alias \
= ::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
>::instance; \
typedef BOOST_PP_CAT(name, _)<> name; \
} \
namespace \
{ \
::boost::parameter::keyword<tag_namespace::name> const& name \
= ::boost::parameter::keyword<tag_namespace::name>::instance; \
}
/**/
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_NESTED_KEYWORD_AUX(tag_namespace, q, name, alias) \
namespace tag_namespace \
{ \
template <int Dummy = 0> \
struct BOOST_PP_CAT(name, _) \
{ \
static BOOST_CONSTEXPR char const* keyword_name() \
{ \
return BOOST_PP_STRINGIZE(name); \
} \
typedef BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE( \
BOOST_PP_CAT(name, _)<Dummy> \
) _; \
typedef BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE( \
BOOST_PP_CAT(name, _)<Dummy> \
) _1; \
typedef ::boost::parameter::q qualifier; \
static ::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
> const& alias; \
}; \
template <int Dummy> \
::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
> const& BOOST_PP_CAT(name, _)<Dummy>::alias \
= ::boost::parameter::keyword< \
BOOST_PP_CAT(name, _)<Dummy> \
>::instance; \
typedef BOOST_PP_CAT(name, _)<> name; \
} \
namespace \
{ \
::boost::parameter::keyword<tag_namespace::name> const& name \
= ::boost::parameter::keyword<tag_namespace::name>::instance; \
}
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
#include <boost/parameter/aux_/preprocessor/qualifier.hpp>
#define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \
BOOST_PARAMETER_NESTED_KEYWORD_AUX( \
tag_namespace \
, BOOST_PARAMETER_GET_QUALIFIER(name) \
, BOOST_PARAMETER_UNQUALIFIED(name) \
, alias \
)
/**/
#endif // include guard