]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/bimap/include/boost/bimap/detail/manage_additional_parameters.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / bimap / include / boost / bimap / detail / manage_additional_parameters.hpp
CommitLineData
7c673cae
FG
1// Boost.Bimap
2//
3// Copyright (c) 2006-2007 Matias Capeletto
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9/// \file detail/manage_additional_parameters.hpp
10/// \brief Utility class to extract the additional parameters from the template parameters.
11
12#ifndef BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
13#define BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
14
15#if defined(_MSC_VER)
16#pragma once
17#endif
18
19#include <boost/config.hpp>
20
21#include <memory>
22
23// Boost.MPL
24#include <boost/mpl/bool.hpp>
25#include <boost/mpl/if.hpp>
26#include <boost/mpl/aux_/na.hpp>
27#include <boost/type_traits/is_same.hpp>
28
29#include <boost/bimap/detail/is_set_type_of.hpp>
30
31namespace boost {
32namespace bimaps {
33
34template< class Type >
35struct with_info
36{
37 typedef Type value_type;
38};
39
40namespace detail {
41
42/// \brief Metafunction to check if a given type is a data_hook specification.
43
44template< class Type >
45struct is_with_info : ::boost::mpl::false_ {};
46
47template< class ValueType >
48struct is_with_info< with_info<ValueType> > : ::boost::mpl::true_ {};
49
50/** \struct boost::bimaps::detail::manage_additional_parameters
51\brief Utility class to extract the additional parameters from the template parameters.
52
53\code
54template< class AP1, class AP2, class AP3 >
55struct manage_additional_parameters
56{
57 struct parameters
58 {
59 typedef -unspecified- set_type_of_relation;
60 typedef -unspecified- data_hook;
61 typedef -unspecified- allocator;
62 };
63
64 typedef parameters type;
65};
66\endcode
67
68See also bimap, bimap_core.
69 **/
70
71#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
72
73template< class AP1, class AP2, class AP3 >
74struct manage_additional_parameters
75{
76 // (1) manage_additional_parameters<
77 // not_specified,not_specified,not_specified>
78 //
79 // set_type_of_relation: based on the left key type
80 // info_hook: no additional info
81 // allocator: default allocator
82
83 struct case_NNN
84 {
85 typedef left_based set_type_of_relation;
86 typedef std::allocator<void> allocator;
87 typedef ::boost::mpl::na additional_info;
88 };
89
90 // (2) manage_additional_parameters<Allocator,not_specified,not_specified>
91 //
92 // set_type_of_relation: based on the left key type
93 // info_hook: no additional info
94 // allocator: Allocator
95
96 struct case_ANN
97 {
98 typedef left_based set_type_of_relation;
99 typedef AP1 allocator;
100 typedef ::boost::mpl::na additional_info;
101 };
102
103 // (3) manage_additional_parameters<
104 // SetOfRelationType,not_specified,not_specified>
105 //
106 // set_type_of_relation: SetTypeOfRelation
107 // info_hook: no additional info
108 // allocator: default allocator
109
110 struct case_SNN
111 {
112 typedef AP1 set_type_of_relation;
113 typedef std::allocator<void> allocator;
114 typedef ::boost::mpl::na additional_info;
115 };
116
117 // (4) manage_additional_parameters<
118 // SetTypeOfRelation,Allocator,not_specified>
119 //
120 // set_type_of_relation: SetTypeOfRelation
121 // info_hook: no additional info
122 // allocator: Allocator
123
124 struct case_SAN
125 {
126 typedef AP1 set_type_of_relation;
127 typedef AP2 allocator;
128 typedef ::boost::mpl::na additional_info;
129 };
130
131 // (5) manage_additional_parameters<InfoToHook,not_specified,not_specified>
132 //
133 // set_type_of_relation: based on the left key type
134 // info_hook: InfoToHook
135 // allocator: default allocator
136
137 struct case_HNN
138 {
139 typedef left_based set_type_of_relation;
140 typedef std::allocator<void> allocator;
141 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
142 };
143
144 // (6) manage_additional_parameters<
145 // SetTypeOfRelation,InfoToHook,not_specified>
146 //
147 // set_type_of_relation: SetTypeOfRelation
148 // info_hook: InfoToHook
149 // allocator: default allocator
150
151 struct case_SHN
152 {
153 typedef AP1 set_type_of_relation;
154 typedef std::allocator<void> allocator;
155 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
156 };
157
158 // (7) manage_additional_parameters<
159 // DataToHook,Allocator,not_specified>
160 //
161 // set_type_of_relation: SetTypeOfRelation
162 // info_hook: InfoToHook
163 // allocator: default allocator
164
165 struct case_HAN
166 {
167 typedef left_based set_type_of_relation;
168 typedef AP2 allocator;
169 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
170 };
171
172 // (8) manage_additional_parameters<
173 // SetTypeOfRelation,DataToHook,Allocator>
174 //
175 // set_type_of_relation: SetTypeOfRelation
176 // info_hook: InfoToHook
177 // allocator: Allocator
178
179 struct case_SHA
180 {
181 typedef AP1 set_type_of_relation;
182 typedef AP2 allocator;
183 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
184 };
185
186 // Some annidated mpl::if_ and we are done!
187
188 typedef BOOST_DEDUCED_TYPENAME mpl::if_
189 <
190 ::boost::mpl::is_na<AP1>,
191 case_NNN, // (1)
192 BOOST_DEDUCED_TYPENAME mpl::if_
193 <
194 ::boost::mpl::is_na<AP2>,
195 BOOST_DEDUCED_TYPENAME mpl::if_
196 <
197 is_set_type_of_relation<AP1>,
198 case_SNN, // (3)
199 BOOST_DEDUCED_TYPENAME mpl::if_
200 <
201 is_with_info<AP1>,
202 case_HNN, // (5)
203 case_ANN // (2)
204
205 >::type
206
207 >::type,
208 BOOST_DEDUCED_TYPENAME mpl::if_
209 <
210 ::boost::mpl::is_na<AP3>,
211 BOOST_DEDUCED_TYPENAME mpl::if_
212 <
213 is_with_info<AP1>,
214 case_HAN, // (7)
215 BOOST_DEDUCED_TYPENAME mpl::if_
216 <
217 is_with_info<AP2>,
218 case_SHN, // (6)
219 case_SAN // (4)
220
221 >::type
222
223 >::type,
224
225 case_SHA // (8)
226
227 >::type
228
229 >::type
230
231 >::type type;
232
233};
234
235#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
236
237} // namespace detail
238} // namespace bimaps
239} // namespace boost
240
241
242#endif // BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
243