File indexing completed on 2025-01-18 09:30:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_CONTAINER_OPTIONS_HPP
0014 #define BOOST_CONTAINER_OPTIONS_HPP
0015
0016 #ifndef BOOST_CONFIG_HPP
0017 # include <boost/config.hpp>
0018 #endif
0019
0020 #if defined(BOOST_HAS_PRAGMA_ONCE)
0021 # pragma once
0022 #endif
0023
0024 #include <boost/container/detail/config_begin.hpp>
0025 #include <boost/container/container_fwd.hpp>
0026 #include <boost/intrusive/pack_options.hpp>
0027 #include <boost/static_assert.hpp>
0028
0029 namespace boost {
0030 namespace container {
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 enum tree_type_enum
0043 {
0044 red_black_tree,
0045 avl_tree,
0046 scapegoat_tree,
0047 splay_tree
0048 };
0049
0050 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0051
0052 template<tree_type_enum TreeType, bool OptimizeSize>
0053 struct tree_opt
0054 {
0055 static const boost::container::tree_type_enum tree_type = TreeType;
0056 static const bool optimize_size = OptimizeSize;
0057 };
0058
0059 typedef tree_opt<red_black_tree, true> tree_assoc_defaults;
0060
0061 #endif
0062
0063
0064
0065 BOOST_INTRUSIVE_OPTION_CONSTANT(tree_type, tree_type_enum, TreeType, tree_type)
0066
0067
0068
0069 BOOST_INTRUSIVE_OPTION_CONSTANT(optimize_size, bool, Enabled, optimize_size)
0070
0071
0072
0073
0074
0075 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0076 template<class ...Options>
0077 #else
0078 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0079 #endif
0080 struct tree_assoc_options
0081 {
0082
0083 typedef typename ::boost::intrusive::pack_options
0084 < tree_assoc_defaults,
0085 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0086 O1, O2, O3, O4
0087 #else
0088 Options...
0089 #endif
0090 >::type packed_options;
0091 typedef tree_opt<packed_options::tree_type, packed_options::optimize_size> implementation_defined;
0092
0093 typedef implementation_defined type;
0094 };
0095
0096 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0097
0098
0099
0100 template<class ...Options>
0101 using tree_assoc_options_t = typename boost::container::tree_assoc_options<Options...>::type;
0102
0103 #endif
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0115
0116 template<bool StoreHash, bool CacheBegin, bool LinearBuckets, bool FastmodBuckets>
0117 struct hash_opt
0118 {
0119 static const bool store_hash = StoreHash;
0120 static const bool cache_begin = CacheBegin;
0121 static const bool linear_buckets = LinearBuckets;
0122 static const bool fastmod_buckets = FastmodBuckets;
0123 };
0124
0125 typedef hash_opt<false, false, false, false> hash_assoc_defaults;
0126
0127 #endif
0128
0129
0130
0131
0132 BOOST_INTRUSIVE_OPTION_CONSTANT(store_hash, bool, Enabled, store_hash)
0133
0134
0135
0136
0137 BOOST_INTRUSIVE_OPTION_CONSTANT(cache_begin, bool, Enabled, cache_begin)
0138
0139 BOOST_INTRUSIVE_OPTION_CONSTANT(linear_buckets, bool, Enabled, linear_buckets)
0140
0141 BOOST_INTRUSIVE_OPTION_CONSTANT(fastmod_buckets, bool, Enabled, fastmod_buckets)
0142
0143
0144
0145
0146
0147 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0148 template<class ...Options>
0149 #else
0150 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0151 #endif
0152 struct hash_assoc_options
0153 {
0154
0155 typedef typename ::boost::intrusive::pack_options
0156 < hash_assoc_defaults,
0157 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0158 O1, O2, O3, O4
0159 #else
0160 Options...
0161 #endif
0162 >::type packed_options;
0163 typedef hash_opt<packed_options::store_hash
0164 ,packed_options::cache_begin
0165 ,packed_options::linear_buckets
0166 ,packed_options::fastmod_buckets
0167 > implementation_defined;
0168
0169 typedef implementation_defined type;
0170 };
0171
0172 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0173
0174
0175
0176 template<class ...Options>
0177 using hash_assoc_options_t = typename boost::container::hash_assoc_options<Options...>::type;
0178
0179 #endif
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0190
0191 template<class T, class Default>
0192 struct default_if_void
0193 {
0194 typedef T type;
0195 };
0196
0197 template<class Default>
0198 struct default_if_void<void, Default>
0199 {
0200 typedef Default type;
0201 };
0202
0203 template<std::size_t N, std::size_t DefaultN>
0204 struct default_if_zero
0205 {
0206 static const std::size_t value = N;
0207 };
0208
0209 template<std::size_t DefaultN>
0210 struct default_if_zero<0u, DefaultN>
0211 {
0212 static const std::size_t value = DefaultN;
0213 };
0214
0215
0216
0217 #endif
0218
0219 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0220
0221 template<class AllocTraits, class StoredSizeType>
0222 struct get_stored_size_type_with_alloctraits
0223 {
0224 typedef StoredSizeType type;
0225 };
0226
0227 template<class AllocTraits>
0228 struct get_stored_size_type_with_alloctraits<AllocTraits, void>
0229 {
0230 typedef typename AllocTraits::size_type type;
0231 };
0232
0233 template<class GrowthType, class StoredSizeType>
0234 struct vector_opt
0235 {
0236 typedef GrowthType growth_factor_type;
0237 typedef StoredSizeType stored_size_type;
0238
0239 template<class AllocTraits>
0240 struct get_stored_size_type
0241 : get_stored_size_type_with_alloctraits<AllocTraits, StoredSizeType>
0242 {};
0243 };
0244
0245 class default_next_capacity;
0246
0247 typedef vector_opt<void, void> vector_null_opt;
0248
0249 #else
0250
0251
0252
0253 struct growth_factor_50{};
0254
0255
0256
0257 struct growth_factor_60{};
0258
0259
0260
0261 struct growth_factor_100{};
0262
0263 #endif
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282 BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_factor_type)
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309 BOOST_INTRUSIVE_OPTION_TYPE(stored_size, StoredSizeType, StoredSizeType, stored_size_type)
0310
0311
0312
0313
0314 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0315 template<class ...Options>
0316 #else
0317 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0318 #endif
0319 struct vector_options
0320 {
0321
0322 typedef typename ::boost::intrusive::pack_options
0323 < vector_null_opt,
0324 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0325 O1, O2, O3, O4
0326 #else
0327 Options...
0328 #endif
0329 >::type packed_options;
0330 typedef vector_opt< typename packed_options::growth_factor_type
0331 , typename packed_options::stored_size_type> implementation_defined;
0332
0333 typedef implementation_defined type;
0334 };
0335
0336 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0337
0338
0339
0340
0341 template<class ...Options>
0342 using vector_options_t = typename boost::container::vector_options<Options...>::type;
0343
0344 #endif
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359 BOOST_INTRUSIVE_OPTION_CONSTANT(inplace_alignment, std::size_t, Alignment, inplace_alignment)
0360
0361 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0362
0363 template<class GrowthType, std::size_t InplaceAlignment>
0364 struct small_vector_opt
0365 {
0366 typedef GrowthType growth_factor_type;
0367 static const std::size_t inplace_alignment = InplaceAlignment;
0368 };
0369
0370 typedef small_vector_opt<void, 0u> small_vector_null_opt;
0371
0372 #endif
0373
0374
0375
0376
0377 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0378 template<class ...Options>
0379 #else
0380 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0381 #endif
0382 struct small_vector_options
0383 {
0384
0385 typedef typename ::boost::intrusive::pack_options
0386 < small_vector_null_opt,
0387 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0388 O1, O2, O3, O4
0389 #else
0390 Options...
0391 #endif
0392 >::type packed_options;
0393 typedef small_vector_opt< typename packed_options::growth_factor_type
0394 , packed_options::inplace_alignment> implementation_defined;
0395
0396 typedef implementation_defined type;
0397 };
0398
0399 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0400
0401
0402
0403
0404 template<class ...Options>
0405 using small_vector_options_t = typename boost::container::small_vector_options<Options...>::type;
0406
0407 #endif
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426 BOOST_INTRUSIVE_OPTION_CONSTANT(throw_on_overflow, bool, ThrowOnOverflow, throw_on_overflow)
0427
0428 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0429
0430 template<bool ThrowOnOverflow, std::size_t InplaceAlignment>
0431 struct static_vector_opt
0432 {
0433 static const bool throw_on_overflow = ThrowOnOverflow;
0434 static const std::size_t inplace_alignment = InplaceAlignment;
0435 };
0436
0437 typedef static_vector_opt<true, 0u> static_vector_null_opt;
0438
0439 #endif
0440
0441
0442
0443
0444 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0445 template<class ...Options>
0446 #else
0447 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0448 #endif
0449 struct static_vector_options
0450 {
0451
0452 typedef typename ::boost::intrusive::pack_options
0453 < static_vector_null_opt,
0454 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0455 O1, O2, O3, O4
0456 #else
0457 Options...
0458 #endif
0459 >::type packed_options;
0460 typedef static_vector_opt< packed_options::throw_on_overflow
0461 , packed_options::inplace_alignment> implementation_defined;
0462
0463 typedef implementation_defined type;
0464 };
0465
0466 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0467
0468
0469
0470
0471 template<class ...Options>
0472 using static_vector_options_t = typename boost::container::static_vector_options<Options...>::type;
0473
0474 #endif
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0501
0502 BOOST_INTRUSIVE_OPTION_CONSTANT(relocate_on, std::size_t, Fraction, free_fraction)
0503
0504 struct relocate_on_66 : public relocate_on<3U>{};
0505
0506 struct relocate_on_75 : public relocate_on<4U> {};
0507
0508 struct relocate_on_80 : public relocate_on<5U> {};
0509
0510 struct relocate_on_85 : public relocate_on<7U> {};
0511
0512 struct relocate_on_90 : public relocate_on<10U> {};
0513
0514 template<class GrowthType, class StoredSizeType, std::size_t FreeFraction>
0515 struct devector_opt
0516 : vector_opt<GrowthType, StoredSizeType>
0517 {
0518 static const std::size_t free_fraction = FreeFraction;
0519 };
0520
0521 typedef devector_opt<void, void, 0u> devector_null_opt;
0522
0523 #else
0524
0525
0526
0527
0528 struct relocate_never;
0529
0530
0531
0532
0533 struct relocate_on_66;
0534
0535
0536
0537
0538 struct relocate_on_75;
0539
0540
0541
0542
0543 struct relocate_on_80;
0544
0545
0546
0547
0548 struct relocate_on_85;
0549
0550
0551
0552
0553 struct relocate_on_90;
0554
0555 #endif
0556
0557
0558
0559
0560
0561
0562 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0563 template<class ...Options>
0564 #else
0565 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0566 #endif
0567 struct devector_options
0568 {
0569
0570 typedef typename ::boost::intrusive::pack_options
0571 < devector_null_opt,
0572 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0573 O1, O2, O3, O4
0574 #else
0575 Options...
0576 #endif
0577 >::type packed_options;
0578 typedef devector_opt< typename packed_options::growth_factor_type
0579 , typename packed_options::stored_size_type
0580 , packed_options::free_fraction
0581 > implementation_defined;
0582
0583 typedef implementation_defined type;
0584 };
0585
0586 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0587
0588
0589
0590
0591 template<class ...Options>
0592 using devector_options_t = typename boost::container::devector_options<Options...>::type;
0593
0594 #endif
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
0605
0606 template<std::size_t BlockBytes, std::size_t BlockSize>
0607 struct deque_opt
0608 {
0609 static const std::size_t block_bytes = BlockBytes;
0610 static const std::size_t block_size = BlockSize;
0611 BOOST_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time");
0612 };
0613
0614 typedef deque_opt<0u, 0u> deque_null_opt;
0615
0616 #endif
0617
0618
0619
0620
0621 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0622 template<class ...Options>
0623 #else
0624 template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
0625 #endif
0626 struct deque_options
0627 {
0628
0629 typedef typename ::boost::intrusive::pack_options
0630 < deque_null_opt,
0631 #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
0632 O1, O2, O3, O4
0633 #else
0634 Options...
0635 #endif
0636 >::type packed_options;
0637 typedef deque_opt< packed_options::block_bytes, packed_options::block_size > implementation_defined;
0638
0639 typedef implementation_defined type;
0640 };
0641
0642 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0643
0644
0645
0646
0647 template<class ...Options>
0648 using deque_options_t = typename boost::container::deque_options<Options...>::type;
0649
0650 #endif
0651
0652
0653
0654
0655
0656
0657 BOOST_INTRUSIVE_OPTION_CONSTANT(block_bytes, std::size_t, BlockBytes, block_bytes)
0658
0659
0660
0661
0662
0663
0664 BOOST_INTRUSIVE_OPTION_CONSTANT(block_size, std::size_t, BlockSize, block_size)
0665
0666 }
0667 }
0668
0669 #include <boost/container/detail/config_end.hpp>
0670
0671 #endif