Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/parameter/name.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // Copyright Daniel Wallin 2006. Use, modification and distribution is | |
2 // subject to the Boost Software License, Version 1.0. (See accompanying | |
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
4 | |
5 #ifndef BOOST_PARAMETER_NAME_060806_HPP | |
6 # define BOOST_PARAMETER_NAME_060806_HPP | |
7 | |
8 # include <boost/parameter/keyword.hpp> | |
9 # include <boost/parameter/value_type.hpp> | |
10 # include <boost/detail/workaround.hpp> | |
11 # include <boost/preprocessor/cat.hpp> | |
12 # include <boost/preprocessor/stringize.hpp> | |
13 # include <boost/preprocessor/control/iif.hpp> | |
14 # include <boost/preprocessor/tuple/eat.hpp> | |
15 # include <boost/preprocessor/tuple/elem.hpp> | |
16 # include <boost/mpl/placeholders.hpp> | |
17 | |
18 # if !defined(BOOST_NO_SFINAE) \ | |
19 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ | |
20 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) | |
21 | |
22 # include <boost/utility/enable_if.hpp> | |
23 # include <boost/mpl/lambda.hpp> | |
24 | |
25 namespace boost { namespace parameter { namespace aux { | |
26 | |
27 // Tag type passed to MPL lambda. | |
28 struct lambda_tag; | |
29 | |
30 struct name_tag_base | |
31 {}; | |
32 | |
33 template <class Tag> | |
34 struct name_tag | |
35 {}; | |
36 | |
37 template <class T> | |
38 struct is_name_tag | |
39 : mpl::false_ | |
40 {}; | |
41 | |
42 }}} // namespace boost::parameter::aux | |
43 | |
44 namespace boost { namespace mpl { | |
45 | |
46 template <class T> | |
47 struct lambda< | |
48 T | |
49 , typename boost::enable_if< | |
50 parameter::aux::is_name_tag<T>, parameter::aux::lambda_tag | |
51 >::type | |
52 > | |
53 { | |
54 typedef true_ is_le; | |
55 typedef bind3< quote3<parameter::value_type>, arg<2>, T, void> result_; | |
56 typedef result_ type; | |
57 }; | |
58 | |
59 }} // namespace boost::mpl | |
60 | |
61 # endif | |
62 | |
63 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) | |
64 # include <boost/preprocessor/detail/split.hpp> | |
65 // From Paul Mensonides | |
66 # define BOOST_PARAMETER_IS_BINARY(x) \ | |
67 BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_BINARY_C x BOOST_PP_COMMA() 0) \ | |
68 /**/ | |
69 # define BOOST_PARAMETER_IS_BINARY_C(x,y) \ | |
70 ~, 1 BOOST_PP_RPAREN() \ | |
71 BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \ | |
72 /**/ | |
73 # else | |
74 # include <boost/preprocessor/detail/is_binary.hpp> | |
75 # define BOOST_PARAMETER_IS_BINARY(x) BOOST_PP_IS_BINARY(x) | |
76 # endif | |
77 | |
78 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) | |
79 # define BOOST_PARAMETER_NAME_OBJECT(tag, name) \ | |
80 static ::boost::parameter::keyword<tag> const& name \ | |
81 = ::boost::parameter::keyword<tag>::instance; | |
82 # else | |
83 # define BOOST_PARAMETER_NAME_OBJECT(tag, name) \ | |
84 namespace \ | |
85 { \ | |
86 ::boost::parameter::keyword<tag> const& name \ | |
87 = ::boost::parameter::keyword<tag>::instance; \ | |
88 } | |
89 # endif | |
90 | |
91 # define BOOST_PARAMETER_BASIC_NAME(tag_namespace, tag, name) \ | |
92 namespace tag_namespace \ | |
93 { \ | |
94 struct tag \ | |
95 { \ | |
96 static char const* keyword_name() \ | |
97 { \ | |
98 return BOOST_PP_STRINGIZE(tag); \ | |
99 } \ | |
100 \ | |
101 typedef boost::parameter::value_type< \ | |
102 boost::mpl::_2, tag, boost::parameter::void_ \ | |
103 > _; \ | |
104 \ | |
105 typedef boost::parameter::value_type< \ | |
106 boost::mpl::_2, tag, boost::parameter::void_ \ | |
107 > _1; \ | |
108 }; \ | |
109 } \ | |
110 BOOST_PARAMETER_NAME_OBJECT(tag_namespace::tag, name) | |
111 | |
112 # define BOOST_PARAMETER_COMPLEX_NAME_TUPLE1(tag,namespace) \ | |
113 (tag, namespace), ~ | |
114 | |
115 # define BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name) \ | |
116 BOOST_PP_TUPLE_ELEM(2, 0, (BOOST_PARAMETER_COMPLEX_NAME_TUPLE1 name)) | |
117 | |
118 # define BOOST_PARAMETER_COMPLEX_NAME_TAG(name) \ | |
119 BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name)) | |
120 | |
121 # define BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \ | |
122 BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name)) | |
123 | |
124 # define BOOST_PARAMETER_COMPLEX_NAME(name) \ | |
125 BOOST_PARAMETER_BASIC_NAME( \ | |
126 BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \ | |
127 , BOOST_PP_TUPLE_EAT(2) name \ | |
128 , BOOST_PARAMETER_COMPLEX_NAME_TAG(name) \ | |
129 ) \ | |
130 /**/ | |
131 | |
132 # define BOOST_PARAMETER_SIMPLE_NAME(name) \ | |
133 BOOST_PARAMETER_BASIC_NAME(tag, name, BOOST_PP_CAT(_, name)) | |
134 | |
135 # define BOOST_PARAMETER_NAME(name) \ | |
136 BOOST_PP_IIF( \ | |
137 BOOST_PARAMETER_IS_BINARY(name) \ | |
138 , BOOST_PARAMETER_COMPLEX_NAME \ | |
139 , BOOST_PARAMETER_SIMPLE_NAME \ | |
140 )(name) \ | |
141 /**/ | |
142 | |
143 | |
144 # define BOOST_PARAMETER_TEMPLATE_KEYWORD(name) \ | |
145 namespace tag \ | |
146 { \ | |
147 struct name; \ | |
148 } \ | |
149 template <class T> \ | |
150 struct name \ | |
151 : boost::parameter::template_keyword<tag::name, T> \ | |
152 {}; \ | |
153 /**/ | |
154 | |
155 #endif // BOOST_PARAMETER_NAME_060806_HPP | |
156 |