3 // Copyright (c) 2006-2007 Matias Capeletto
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)
9 /// \file detail/manage_additional_parameters.hpp
10 /// \brief Utility class to extract the additional parameters from the template parameters.
12 #ifndef BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
13 #define BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
19 #include <boost/config.hpp>
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>
29 #include <boost/bimap/detail/is_set_type_of.hpp>
34 template< class Type >
37 typedef Type value_type;
42 /// \brief Metafunction to check if a given type is a data_hook specification.
44 template< class Type >
45 struct is_with_info : ::boost::mpl::false_ {};
47 template< class ValueType >
48 struct is_with_info< with_info<ValueType> > : ::boost::mpl::true_ {};
50 /** \struct boost::bimaps::detail::manage_additional_parameters
51 \brief Utility class to extract the additional parameters from the template parameters.
54 template< class AP1, class AP2, class AP3 >
55 struct manage_additional_parameters
59 typedef -unspecified- set_type_of_relation;
60 typedef -unspecified- data_hook;
61 typedef -unspecified- allocator;
64 typedef parameters type;
68 See also bimap, bimap_core.
71 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
73 template< class AP1, class AP2, class AP3 >
74 struct manage_additional_parameters
76 // (1) manage_additional_parameters<
77 // not_specified,not_specified,not_specified>
79 // set_type_of_relation: based on the left key type
80 // info_hook: no additional info
81 // allocator: default allocator
85 typedef left_based set_type_of_relation;
86 typedef std::allocator<void> allocator;
87 typedef ::boost::mpl::na additional_info;
90 // (2) manage_additional_parameters<Allocator,not_specified,not_specified>
92 // set_type_of_relation: based on the left key type
93 // info_hook: no additional info
94 // allocator: Allocator
98 typedef left_based set_type_of_relation;
99 typedef AP1 allocator;
100 typedef ::boost::mpl::na additional_info;
103 // (3) manage_additional_parameters<
104 // SetOfRelationType,not_specified,not_specified>
106 // set_type_of_relation: SetTypeOfRelation
107 // info_hook: no additional info
108 // allocator: default allocator
112 typedef AP1 set_type_of_relation;
113 typedef std::allocator<void> allocator;
114 typedef ::boost::mpl::na additional_info;
117 // (4) manage_additional_parameters<
118 // SetTypeOfRelation,Allocator,not_specified>
120 // set_type_of_relation: SetTypeOfRelation
121 // info_hook: no additional info
122 // allocator: Allocator
126 typedef AP1 set_type_of_relation;
127 typedef AP2 allocator;
128 typedef ::boost::mpl::na additional_info;
131 // (5) manage_additional_parameters<InfoToHook,not_specified,not_specified>
133 // set_type_of_relation: based on the left key type
134 // info_hook: InfoToHook
135 // allocator: default allocator
139 typedef left_based set_type_of_relation;
140 typedef std::allocator<void> allocator;
141 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
144 // (6) manage_additional_parameters<
145 // SetTypeOfRelation,InfoToHook,not_specified>
147 // set_type_of_relation: SetTypeOfRelation
148 // info_hook: InfoToHook
149 // allocator: default allocator
153 typedef AP1 set_type_of_relation;
154 typedef std::allocator<void> allocator;
155 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
158 // (7) manage_additional_parameters<
159 // DataToHook,Allocator,not_specified>
161 // set_type_of_relation: SetTypeOfRelation
162 // info_hook: InfoToHook
163 // allocator: default allocator
167 typedef left_based set_type_of_relation;
168 typedef AP2 allocator;
169 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
172 // (8) manage_additional_parameters<
173 // SetTypeOfRelation,DataToHook,Allocator>
175 // set_type_of_relation: SetTypeOfRelation
176 // info_hook: InfoToHook
177 // allocator: Allocator
181 typedef AP1 set_type_of_relation;
182 typedef AP2 allocator;
183 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
186 // Some annidated mpl::if_ and we are done!
188 typedef BOOST_DEDUCED_TYPENAME mpl::if_
190 ::boost::mpl::is_na<AP1>,
192 BOOST_DEDUCED_TYPENAME mpl::if_
194 ::boost::mpl::is_na<AP2>,
195 BOOST_DEDUCED_TYPENAME mpl::if_
197 is_set_type_of_relation<AP1>,
199 BOOST_DEDUCED_TYPENAME mpl::if_
208 BOOST_DEDUCED_TYPENAME mpl::if_
210 ::boost::mpl::is_na<AP3>,
211 BOOST_DEDUCED_TYPENAME mpl::if_
215 BOOST_DEDUCED_TYPENAME mpl::if_
235 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
237 } // namespace detail
238 } // namespace bimaps
242 #endif // BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP