Added options for small_vector: inplace_alignment and growth_factor. Fixes #47

This commit is contained in:
Ion Gaztañaga committed 2019-05-09 22:15:43 +02:00
1 parent 1e9b4a15eb
commit 4c348af1eb
6 files changed
+205 -61

No files matched your search

+33 -2
View File
@@ -730,7 +730,7 @@ The configuration for [classref boost::container::static_vector static_vector] i
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
* [classref boost::container::inplace_alignment inplace_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
@@ -746,6 +746,33 @@ used to customize `static_vector` container:
[endsect]
[section:configurable_small_vectors Configurable small vector]
The configuration for [classref boost::container::small_vector small_vector] is passed as
the last template parameter and defined using the utility class
[classref boost::container::small_vector_options small_vector_options]. The following parameters can be configured:
* [classref boost::container::inplace_alignment inplace_alignment]: the minimum alignment (in bytes) for the in-place storage
used to build the "small" number of elements. [*The alignment of the dynamic memory must be provided by the allocator
and it is not affected by this option].
* [classref boost::container::growth_factor growth_factor]: the growth policy of the vector.
The rate at which the capacity of a vector grows is implementation dependent and
implementations choose exponential growth in order to meet the amortized constant time requirement for push_back.
A higher growth factor will make it faster as it will require less data movement, but it will have a greater memory
impact (on average, more memory will be unused). A user can provide a custom implementation of the growth factor and some
predefined policies are available: [classref boost::container::growth_factor_50 growth_factor_50],
[classref boost::container::growth_factor_60 growth_factor_60] and
[classref boost::container::growth_factor_50 growth_factor_100].
See the following example to see how [classref boost::container::small_vector_options small_vector_options] can be
used to customize `small_vector` container:
[import ../example/doc_custom_small_vector.cpp]
[doc_custom_small_vector]
[endsect]
[endsect]
[section:extended_allocators Extended functionality: Extended allocators]
@@ -1295,6 +1322,7 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes_boost_1_71_00 Boost 1.71 Release]
* Fixed bugs:
* [@https://github.com/boostorg/container/pull/47 GitHub #47: ['"added alignment specification for small_vector"]].
* [@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)"]].
@@ -1309,7 +1337,10 @@ use [*Boost.Container]? There are several reasons for that:
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.
Alignment and throwing behaviour can be be specified.
* [classref boost::container::small_vector small_vector] can now have options, using [classref boost::container::small_vector_options small_vector_options].
Alignment and growth factor can be be specified.
[endsect]