diff --git a/doc/container.qbk b/doc/container.qbk index b1dfa1f..67344f8 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -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] diff --git a/include/boost/container/container_fwd.hpp b/include/boost/container/container_fwd.hpp index 529b739..8ed29c0 100644 --- a/include/boost/container/container_fwd.hpp +++ b/include/boost/container/container_fwd.hpp @@ -106,7 +106,7 @@ template class stable_vector; -template +template class static_vector; template diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index 7270188..28e7ae9 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -195,17 +195,17 @@ struct insert_move_proxy typedef typename alloc_traits::size_type size_type; typedef typename alloc_traits::value_type value_type; - explicit insert_move_proxy(value_type &v) + BOOST_CONTAINER_FORCEINLINE explicit insert_move_proxy(value_type &v) : v_(v) {} - void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const { BOOST_ASSERT(n == 1); (void)n; alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) ); } - void copy_n_and_update(Allocator &, Iterator p, size_type n) const + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n) const { BOOST_ASSERT(n == 1); (void)n; *p = ::boost::move(v_); diff --git a/include/boost/container/detail/container_rebind.hpp b/include/boost/container/detail/container_rebind.hpp index 32b8059..0af9b9e 100644 --- a/include/boost/container/detail/container_rebind.hpp +++ b/include/boost/container/detail/container_rebind.hpp @@ -19,6 +19,7 @@ #endif #include +#include namespace boost { @@ -49,27 +50,6 @@ namespace dtl { typedef Cont type; }; - //for small_vector,static_vector - - template