File indexing completed on 2025-01-18 09:29:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef BOOST_BIMAP_BIMAP_HPP
0046 #define BOOST_BIMAP_BIMAP_HPP
0047
0048 #if defined(_MSC_VER)
0049 #pragma once
0050 #endif
0051
0052 #include <boost/config.hpp>
0053 #include <boost/bimap/detail/user_interface_config.hpp>
0054 #include <boost/mpl/aux_/na.hpp>
0055
0056 #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
0057 #include <boost/core/serialization.hpp>
0058 #endif
0059
0060
0061 #include <boost/bimap/detail/bimap_core.hpp>
0062 #include <boost/bimap/detail/map_view_base.hpp>
0063 #include <boost/bimap/detail/modifier_adaptor.hpp>
0064 #include <boost/bimap/relation/support/data_extractor.hpp>
0065 #include <boost/bimap/relation/support/member_with_tag.hpp>
0066
0067 #include <boost/bimap/support/map_type_by.hpp>
0068 #include <boost/bimap/support/map_by.hpp>
0069 #include <boost/bimap/support/iterator_type_by.hpp>
0070
0071
0072
0073 namespace boost {
0074
0075
0076
0077
0078
0079 namespace bimaps {
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126 template
0127 <
0128 class KeyTypeA, class KeyTypeB,
0129 class AP1 = ::boost::mpl::na,
0130 class AP2 = ::boost::mpl::na,
0131 class AP3 = ::boost::mpl::na
0132 >
0133 class bimap
0134 :
0135
0136
0137 public ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>,
0138
0139
0140
0141 public ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>
0142 ::relation_set,
0143
0144
0145
0146 public ::boost::bimaps::detail:: left_map_view_extra_typedefs<
0147 BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::left_map_view_type<
0148 ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>
0149 >::type
0150 >,
0151 public ::boost::bimaps::detail::right_map_view_extra_typedefs<
0152 BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::right_map_view_type<
0153 ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>
0154 >::type
0155 >
0156 {
0157 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
0158 bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3> base_;
0159
0160 BOOST_DEDUCED_TYPENAME base_::core_type core;
0161
0162 public:
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
0182 left_map_view_type<base_>::type left_map;
0183 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
0184 right_map_view_type<base_>::type right_map;
0185
0186 typedef BOOST_DEDUCED_TYPENAME
0187 left_map::iterator left_iterator;
0188 typedef BOOST_DEDUCED_TYPENAME
0189 left_map::const_iterator left_const_iterator;
0190
0191 typedef BOOST_DEDUCED_TYPENAME
0192 right_map::iterator right_iterator;
0193 typedef BOOST_DEDUCED_TYPENAME
0194 right_map::const_iterator right_const_iterator;
0195
0196 typedef BOOST_DEDUCED_TYPENAME
0197 left_map::reference left_reference;
0198 typedef BOOST_DEDUCED_TYPENAME
0199 left_map::const_reference left_const_reference;
0200
0201 typedef BOOST_DEDUCED_TYPENAME
0202 right_map::reference right_reference;
0203 typedef BOOST_DEDUCED_TYPENAME
0204 right_map::const_reference right_const_reference;
0205
0206 typedef BOOST_DEDUCED_TYPENAME base_::relation::info_type info_type;
0207
0208 typedef BOOST_DEDUCED_TYPENAME base_::core_type::allocator_type allocator_type;
0209
0210
0211 left_map left;
0212
0213
0214 right_map right;
0215
0216 typedef BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag
0217 logic_relation_set_tag;
0218 typedef BOOST_DEDUCED_TYPENAME base_::logic_left_tag logic_left_tag;
0219 typedef BOOST_DEDUCED_TYPENAME base_::logic_right_tag logic_right_tag;
0220 typedef BOOST_DEDUCED_TYPENAME base_::core_type::ctor_args_list
0221 ctor_args_list;
0222
0223 bimap(const allocator_type& al = allocator_type()) :
0224
0225 base_::relation_set(
0226 ::boost::multi_index::get<
0227 logic_relation_set_tag
0228 >(core)
0229 ),
0230
0231 core(al),
0232
0233 left (
0234 ::boost::multi_index::get<
0235 logic_left_tag
0236 >(core)
0237 ),
0238 right (
0239 ::boost::multi_index::get<
0240 logic_right_tag
0241 >(core)
0242 )
0243
0244 {}
0245
0246 template< class InputIterator >
0247 bimap(InputIterator first,InputIterator last,
0248 const allocator_type& al = allocator_type()) :
0249
0250 base_::relation_set(
0251 ::boost::multi_index::get<
0252 BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core)
0253 ),
0254
0255 core(first,last,ctor_args_list(),al),
0256
0257 left (
0258 ::boost::multi_index::get<
0259 BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core)
0260 ),
0261 right (
0262 ::boost::multi_index::get<
0263 BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core)
0264 )
0265
0266 {}
0267
0268 bimap(const bimap& x) :
0269
0270 base_::relation_set(
0271 ::boost::multi_index::get<
0272 BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core)
0273 ),
0274
0275 core(x.core),
0276
0277 left (
0278 ::boost::multi_index::get<
0279 BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core)
0280 ),
0281 right (
0282 ::boost::multi_index::get<
0283 BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core)
0284 )
0285
0286 {}
0287
0288 bimap& operator=(const bimap& x)
0289 {
0290 core = x.core;
0291 return *this;
0292 }
0293
0294
0295
0296 template< class IteratorType >
0297 left_iterator project_left(IteratorType iter)
0298 {
0299 return core.template project<
0300 BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
0301 }
0302
0303 template< class IteratorType >
0304 left_const_iterator project_left(IteratorType iter) const
0305 {
0306 return core.template project<
0307 BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
0308 }
0309
0310 template< class IteratorType >
0311 right_iterator project_right(IteratorType iter)
0312 {
0313 return core.template project<
0314 BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());
0315 }
0316
0317 template< class IteratorType >
0318 right_const_iterator project_right(IteratorType iter) const
0319 {
0320 return core.template project<
0321 BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());
0322 }
0323
0324 template< class IteratorType >
0325 BOOST_DEDUCED_TYPENAME base_::relation_set::iterator
0326 project_up(IteratorType iter)
0327 {
0328 return core.template project<
0329 BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(iter.base());
0330 }
0331
0332 template< class IteratorType >
0333 BOOST_DEDUCED_TYPENAME base_::relation_set::const_iterator
0334 project_up(IteratorType iter) const
0335 {
0336 return core.template project<
0337 BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(iter.base());
0338 }
0339
0340
0341
0342 template< class Tag, class IteratorType >
0343 BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
0344 iterator_type_by<Tag,bimap>::type
0345 project(IteratorType iter)
0346 {
0347 return core.template project<Tag>(iter.base());
0348 }
0349
0350 template< class Tag, class IteratorType >
0351 BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
0352 const_iterator_type_by<Tag,bimap>::type
0353 project(IteratorType iter) const
0354 {
0355 return core.template project<Tag>(iter.base());
0356 }
0357
0358 template< class Tag >
0359 struct map_by :
0360 public ::boost::bimaps::support::map_type_by<Tag,bimap>::type
0361 {
0362 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
0363 map_type_by<Tag,bimap>::type type;
0364
0365 private: map_by() {}
0366 };
0367
0368 template< class Tag >
0369 BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
0370 map_type_by<Tag,bimap>::type &by()
0371 {
0372 return ::boost::bimaps::support::map_by<Tag>(*this);
0373 }
0374
0375 template< class Tag >
0376 const BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
0377 map_type_by<Tag,bimap>::type &by() const
0378 {
0379 return ::boost::bimaps::support::map_by<Tag>(*this);
0380 }
0381
0382
0383 #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
0384
0385
0386
0387 private:
0388
0389 friend class boost::serialization::access;
0390
0391 template<class Archive>
0392 void serialize(Archive & ar, const unsigned int)
0393 {
0394 ar & serialization::make_nvp("mi_core",core);
0395 }
0396
0397 #endif
0398 };
0399
0400 }
0401 }
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420 #include <boost/bimap/tags/tagged.hpp>
0421 #include <boost/bimap/relation/member_at.hpp>
0422 #include <boost/multi_index/detail/unbounded.hpp>
0423
0424
0425 namespace boost {
0426 namespace bimaps {
0427
0428 using ::boost::bimaps::tags::tagged;
0429
0430 namespace member_at = ::boost::bimaps::relation::member_at;
0431
0432 using ::boost::multi_index::unbounded;
0433
0434 }
0435 }
0436
0437
0438 #endif