Added options to static_vector: throw_on_overflow/alignment

This commit is contained in:
Ion Gaztañaga committed 2019-05-09 13:25:50 +02:00
1 parent e23c57337f
commit 5d96b11fe0
7 files changed
+336 -218

No files matched your search

+39 -8
View File
@@ -627,6 +627,11 @@ then the operation is constant time, even with an O(1) size.
[section:configurable_containers Extended functionality: Configurable containers]
[*Boost.Container] offers the possibility to configure at compile time some parameters of
several containers, apart from the stored type and the allocator. This configuration is passed as
the last template parameter and defined using the utility classes. The following containers can receive
useful configuration options:
[section:configurable_tree_based_associative_containers Configurable tree-based associative ordered containers]
[classref boost::container::set set], [classref boost::container::multiset multiset],
@@ -667,8 +672,7 @@ used to customize these containers:
[section:configurable_vectors Configurable vectors]
[*Boost.Container] offers the possibility to configure at compile time some parameters of
[classref boost::container::vector vector] implementation. This configuration is passed as
The configuration for [classref boost::container::vector vector] is passed as
the last template parameter and defined using the utility class
[classref boost::container::vector_options vector_options]. The following parameters can be configured:
@@ -697,10 +701,9 @@ used to customize `vector` container:
[section:configurable_deques Configurable deques]
[*Boost.Container] offers the possibility to configure at compile time some parameters of
[classref boost::container::deque deque] implementation. This configuration is passed as
The configuration for [classref boost::container::deque deque] is passed as
the last template parameter and defined using the utility class
[classref boost::container::deque_options deque_options].The following parameters can be configured:
[classref boost::container::deque_options deque_options]. The following parameters can be configured:
Parameters that control the size of deque's 'block' (deque allocates contiguous chunks of elements, called 'blocks').
Only one of these paratemers can be specified:
@@ -708,6 +711,7 @@ Only one of these paratemers can be specified:
* [classref boost::container::block_bytes block_bytes]: the number of bytes deque will allocate for store
elements contiguously: `deque::get_block_size()` will return aproximately `block_bytes/sizeof(value_type)`.
A value of zero means the default value.
* [classref boost::container::block_size block_size]: the number of elements deque will allocate contiguously.
If this option is specified, `deque::get_block_size()` will return the specified `block_size`.
A value of zero means the default value.
@@ -720,6 +724,28 @@ used to customize `deque` container:
[endsect]
[section:configurable_static_vectors Configurable static vector]
The configuration for [classref boost::container::static_vector static_vector] is passed as
the last template parameter and defined using the utility class
[classref boost::container::static_vector_options static_vector_options]. The following parameters can be configured:
* [classref boost::container::alignment alignment]: the minimum alignment (in bytes) that the stored value type
needs. This option allows static vectors that need non-default alignments, e.g., to be used in SIMD operations.
* [classref boost::container::throw_on_overflow throw_on_overflow]: A boolean that specifies if the
container should throw an exception when the compile-time capacity is not enough to hold the requesteed number
of objects. When "false", if the capacit is overflowd, the implementation calls to BOOST_ASSERT and if that assertion
does not throw or abort, undefined behavior is triggered.
See the following example to see how [classref boost::container::static_vector_options static_vector_options] can be
used to customize `static_vector` container:
[import ../example/doc_custom_static_vector.cpp]
[doc_custom_static_vector]
[endsect]
[endsect]
[section:extended_allocators Extended functionality: Extended allocators]
@@ -1267,19 +1293,24 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes Release Notes]
[section:release_notes_boost_1_71_00 Boost 1.71 Release]
* Fixed bugs:
* [@https://github.com/boostorg/container/issues/88 GitHub #88: ['"Implement C++17 MoveAssignable requirements for self-move assignments"]].
* [@https://github.com/boostorg/container/issues/107 GitHub #107: ['"Alignment ignored in resource_adaptor"]].
* [@https://github.com/boostorg/container/pull/109 GitHub #109: ['"Get rid of integer overflow in copy_move_algo.hpp (-fsanitize=integer)"]].
* [@https://github.com/boostorg/container/pull/110 GitHub #110: ['"Avoid gcc 9 deprecated copy warnings in new_allocator.hpp"]].
* [@https://github.com/boostorg/container/pull/109 GitHub #109: ['"Get rid of integer overflow in copy_move_algo.hpp (-fsanitize=integer)"]].
* [@https://github.com/boostorg/container/pull/110 GitHub #110: ['"Avoid gcc 9 deprecated copy warnings in new_allocator.hpp"]].
* [@https://github.com/boostorg/container/issues/112 GitHub #112: ['"vector::resize() compilation error with msvc-10..12: data is not a member of boost::detail::aligned_storage"]].
* [@https://github.com/boostorg/container/issues/114 GitHub #114: ['"Fix small_vector noexcept specification"]].
* [@https://github.com/boostorg/container/issues/116 GitHub #116: ['"MSVC + boost 1.70 compilation error when windows.h is already included (detail/thread_mutex.hpp)"]].
* [@https://github.com/boostorg/container/issues/117 GitHub #117: ['"flat_map/map::insert_or_assign with hint has wrong return types"]].
* [@https://github.com/boostorg/container/issues/118 GitHub #118: ['"Non-unique inplace_set_difference used in in flat_tree_merge_unique and iterator invalidation in insert_unique"]].
* ['deque] can now have options, using [classref boost::container::deque_options deque_options].
* [classref boost::container::deque deque] can now have options, using [classref boost::container::deque_options deque_options].
The block size/bytes can be be specified.
* [classref boost::container::static_vector static_vector] can now have options, using [classref boost::container::static_vector_options static_vector_options].
The alignment and throwing behaviour can be be specified.
[endsect]
[section:release_notes_boost_1_70_00 Boost 1.70 Release]