diff --git a/bench/bench_vectors.cpp b/bench/bench_vectors.cpp index 5f95bf9..80b16e1 100644 --- a/bench/bench_vectors.cpp +++ b/bench/bench_vectors.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include //std::allocator @@ -447,9 +447,9 @@ void test_vectors_impl() vector_test_template< bc::deque >, Operation >(numit[i], numele[i], "deque ", bp); vector_test_template< bc::deque, typename bc::deque_options >::type >, Operation >(numit[i], numele[i], "deque(reserv) ", bp); - vector_test_template< bc::segmented_vector >, Operation >(numit[i], numele[i], "segmented_vec ", bp); - vector_test_template< bc::segmented_vector, - typename bc::deque_options >::type >, Operation >(numit[i], numele[i], "seg_vec(reserv)", bp); + vector_test_template< bc::segtor >, Operation >(numit[i], numele[i], "segtor ", bp); + vector_test_template< bc::segtor, + typename bc::segtor_options >::type >, Operation >(numit[i], numele[i], "segtor(reserv) ", bp); } std::cout << "---------------------------------\n---------------------------------\n"; } diff --git a/doc/container.qbk b/doc/container.qbk index 68e80aa..f745ddd 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -40,7 +40,7 @@ In short, what does [*Boost.Container] offer? * New advanced features (e.g. recursive containers) and [link container.configurable_containers configurability options for containers]. * Containers support stateful allocators and are compatible with [*Boost.Interprocess] (they can be safely placed in shared memory) offering improved performance vs standard containers when using Boost.Interprocess. -* You have very useful non-standard containers like `[stable/static/small]_vector`, `flat_[multi]set/map`, `devector` or `segmented_vector`. +* You have very useful non-standard containers like `[stable/static/small]_vector`, `flat_[multi]set/map`, `devector` or `segtor`. * If you work on multiple platforms, you'll have a portable behaviour without depending on the std-lib implementation conformance for each platform. Some examples: * [link container.extended_functionality Extended functionality] beyond the standard based @@ -63,7 +63,7 @@ In short, what does [*Boost.Container] offer? has to be increased. This minimum capacity is specified at compile time. * [classref boost::container::devector devector]: is a hybrid of the standard vector and deque containers. It offers cheap (amortized constant time) insertion at both the front and back ends. - * [classref boost::container::segmented_vector segmented_vector]: a sequence container with segmented + * [classref boost::container::segtor segtor]: a sequence container with segmented (block-based) storage like deque but only growth at the back; constant-time push_back/pop_back, random access. * [classref boost::container::slist slist]: the classic pre-standard singly linked list implementation offering constant-time `size()`. Note that C++11 `forward_list` has no `size()`. @@ -571,9 +571,9 @@ stateful allocators, etc. [endsect] -[section:segmented_vector ['segmented_vector]] +[section:segtor ['segtor]] -[classref boost::container::segmented_vector segmented_vector] is a sequence container that supports random access to elements, constant-time insertion and +[classref boost::container::segtor segtor] is a sequence container that supports random access to elements, constant-time insertion and removal at the end, and linear-time insertion and removal in the middle. It uses the same segmented (block-based) storage as `deque` but only allows growth at the back: it provides `push_back`, `pop_back`, `emplace_back`, and the like, but does not provide `push_front`, `pop_front`, or `emplace_front`. In that sense it is the single-ended @@ -585,7 +585,7 @@ expensive to move or when growth is large. Inserting or erasing at the end does references/pointers to existing elements. Insertions and erasures in the middle invalidate iterators and references in the same way as for `deque`. -The container can be configured via [classref boost::container::segmented_vector_options segmented_vector_options] +The container can be configured via [classref boost::container::segtor_options segtor_options] to control block size and other parameters. [endsect] @@ -796,11 +796,11 @@ used to customize `small_vector`: [endsect] -[section:configurable_deque Configurable deque / segmented_vector] +[section:configurable_deque Configurable deque / segtor] -The configuration for [classref boost::container::deque deque] / [classref boost::container::segmented_vector segmented_vector] +The configuration for [classref boost::container::deque deque] / [classref boost::container::segtor segtor] is passed as the last template parameter and defined using the utility class -[classref boost::container::deque_options deque_options] and [classref boost::container::segmented_vector_options segmented_vector_options] respectively. +[classref boost::container::deque_options deque_options] and [classref boost::container::segtor_options segtor_options] respectively. The following parameters can be configured: Parameters that control the size of container's 'block'/'segment' (the container allocates contiguous chunks of elements, called 'blocks'/'segments'). @@ -826,11 +826,11 @@ used to customize `deque`: [import ../example/doc_custom_deque.cpp] [doc_custom_deque] -See the following example to see how [classref boost::container::segmented_vector_options segmented_vector_options] can be -used to customize `segmented_vector`: +See the following example to see how [classref boost::container::segtor_options segtor_options] can be +used to customize `segtor`: -[import ../example/doc_custom_segmented_vector.cpp] -[doc_custom_segmented_vector] +[import ../example/doc_custom_segtor.cpp] +[doc_custom_segtor] [endsect] @@ -1373,7 +1373,7 @@ This table shows the `sizeof` value of Boost.Container containers in 32 and 64 b [[`vector`] [12] [24] ] [[`deque`] [16] [32] ] [[`devector`] [16] [32] ] -[[`segmented_vector`] [12] [24] ] +[[`segtor`] [12] [24] ] [[`stable_vector`] [20] [40] ] [[`list`] [12] [24] ] [[`slist`] [8] [16] ] @@ -1483,7 +1483,7 @@ collect them containers and build [*Boost.Container], a library targeted to a wi * Added [classref boost::container::inline_chars inline_chars], [classref boost::container::growth_factor growth_factor] and [classref boost::container::stored_size stored_size] options to [classref boost::container::basic_string basic_string]. - * New [classref boost::container::segmented_vector segmented_vector] container: the single ended brother of + * New [classref boost::container::segtor segtor] container: the single ended brother of [classref boost::container::deque deque]: a random-access sequence container with segmented (block-based) storage like deque but only growth at the back. * Fixed bugs/issues: diff --git a/example/doc_custom_segmented_vector.cpp b/example/doc_custom_segmented_vector.cpp deleted file mode 100644 index 5fb32c1..0000000 --- a/example/doc_custom_segmented_vector.cpp +++ /dev/null @@ -1,90 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2025. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -//[doc_custom_segmented_vector -#include - -//Make sure assertions are active -#ifdef NDEBUG -#undef NDEBUG -#endif -#include - -int main () -{ - using namespace boost::container; - -//-------------------------------------------- -// 'stored_size' option -//-------------------------------------------- - - //This option specifies that a segmented_vector will use "unsigned char" as - //the type to store capacity or size internally. - typedef segmented_vector_options< stored_size >::type size_option_t; - - //Size-optimized segmented_vector is smaller than the default one. - typedef segmented_vector, size_option_t > size_optimized_segmented_vector_t; - assert(( sizeof(size_optimized_segmented_vector_t) < sizeof(segmented_vector) )); - - //Requesting capacity for more elements than representable by "unsigned char" - //is an error in the size optimized segmented_vector. - bool exception_thrown = false; - /*<-*/ - #ifndef BOOST_NO_EXCEPTIONS - BOOST_CONTAINER_TRY{ size_optimized_segmented_vector_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END - #else - exception_thrown = true; - #endif //BOOST_NO_EXCEPTIONS - /*->*/ - //=try { size_optimized_segmented_vector_t v(256); } - //=catch(...){ exception_thrown = true; } - - assert(exception_thrown == true); - -//-------------------------------------------- -// 'block_size/segment_size' option -//-------------------------------------------- - - //This option specifies the desired block size for segmented_vector - typedef segmented_vector_options< block_size<128u> >::type block_128_option_t; - - //segment_size is an alias for block_size (an alias for block_size) - typedef segmented_vector_options< segment_size<128u> >::type segment_128_option_t; - - //This segmented_vector will allocate blocks of 128 elements - typedef segmented_vector block_128_segmented_vector_t; - assert(block_128_segmented_vector_t::get_block_size() == 128u); - - //This segmented_vector will allocate segments of 128 elements (an alias for block_size) - typedef segmented_vector segment_128_segmented_vector_t; - assert(segment_128_segmented_vector_t::get_block_size() == 128u); - -//-------------------------------------------- -// 'block_bytes/segment_bytes' option -//-------------------------------------------- - - //This option specifies the maximum block size for segmented_vector - //in bytes - typedef segmented_vector_options< block_bytes<1024u> >::type block_1024_bytes_option_t; - - //This option specifies the maximum segment size for segmented_vector - //in bytes (an alias for block_bytes) - typedef segmented_vector_options< segment_bytes<1024u> >::type segment_1024_bytes_option_t; - - //This segmented_vector will allocate blocks of 1024 bytes - typedef segmented_vector block_1024_bytes_segmented_vector_t; - assert(block_1024_bytes_segmented_vector_t::get_block_size() == 1024u/sizeof(int)); - - //This segmented_vector will allocate blocks of 1024 bytes (an alias for block_bytes) - typedef segmented_vector segment_1024_bytes_segmented_vector_t; - assert(segment_1024_bytes_segmented_vector_t::get_block_size() == 1024u/sizeof(int)); - - return 0; -} -//] diff --git a/example/doc_custom_segtor.cpp b/example/doc_custom_segtor.cpp new file mode 100644 index 0000000..f384ff2 --- /dev/null +++ b/example/doc_custom_segtor.cpp @@ -0,0 +1,90 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2025. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +//[doc_custom_segtor +#include + +//Make sure assertions are active +#ifdef NDEBUG +#undef NDEBUG +#endif +#include + +int main () +{ + using namespace boost::container; + +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + + //This option specifies that a segtor will use "unsigned char" as + //the type to store capacity or size internally. + typedef segtor_options< stored_size >::type size_option_t; + + //Size-optimized segtor is smaller than the default one. + typedef segtor, size_option_t > size_optimized_segtor_t; + assert(( sizeof(size_optimized_segtor_t) < sizeof(segtor) )); + + //Requesting capacity for more elements than representable by "unsigned char" + //is an error in the size optimized segtor. + bool exception_thrown = false; + /*<-*/ + #ifndef BOOST_NO_EXCEPTIONS + BOOST_CONTAINER_TRY{ size_optimized_segtor_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END + #else + exception_thrown = true; + #endif //BOOST_NO_EXCEPTIONS + /*->*/ + //=try { size_optimized_segtor_t v(256); } + //=catch(...){ exception_thrown = true; } + + assert(exception_thrown == true); + +//-------------------------------------------- +// 'block_size/segment_size' option +//-------------------------------------------- + + //This option specifies the desired block size for segtor + typedef segtor_options< block_size<128u> >::type block_128_option_t; + + //segment_size is an alias for block_size (an alias for block_size) + typedef segtor_options< segment_size<128u> >::type segment_128_option_t; + + //This segtor will allocate blocks of 128 elements + typedef segtor block_128_segtor_t; + assert(block_128_segtor_t::get_block_size() == 128u); + + //This segtor will allocate segments of 128 elements (an alias for block_size) + typedef segtor segment_128_segtor_t; + assert(segment_128_segtor_t::get_block_size() == 128u); + +//-------------------------------------------- +// 'block_bytes/segment_bytes' option +//-------------------------------------------- + + //This option specifies the maximum block size for segtor + //in bytes + typedef segtor_options< block_bytes<1024u> >::type block_1024_bytes_option_t; + + //This option specifies the maximum segment size for segtor + //in bytes (an alias for block_bytes) + typedef segtor_options< segment_bytes<1024u> >::type segment_1024_bytes_option_t; + + //This segtor will allocate blocks of 1024 bytes + typedef segtor block_1024_bytes_segtor_t; + assert(block_1024_bytes_segtor_t::get_block_size() == 1024u/sizeof(int)); + + //This segtor will allocate blocks of 1024 bytes (an alias for block_bytes) + typedef segtor segment_1024_bytes_segtor_t; + assert(segment_1024_bytes_segtor_t::get_block_size() == 1024u/sizeof(int)); + + return 0; +} +//] diff --git a/include/boost/container/container_fwd.hpp b/include/boost/container/container_fwd.hpp index d6379b7..06e11f6 100644 --- a/include/boost/container/container_fwd.hpp +++ b/include/boost/container/container_fwd.hpp @@ -30,7 +30,7 @@ //! - boost::container::small_vector //! - boost::container::devector //! - boost::container::deque -//! - boost::container::segmented_vector +//! - boost::container::segtor //! - boost::container::slist //! - boost::container::list //! - boost::container::set @@ -137,7 +137,7 @@ class deque; template -class segmented_vector; +class segtor; template diff --git a/include/boost/container/options.hpp b/include/boost/container/options.hpp index 75e1ef5..b68cfd6 100644 --- a/include/boost/container/options.hpp +++ b/include/boost/container/options.hpp @@ -700,7 +700,7 @@ using deque_options_t = typename boost::container::deque_options::ty //////////////////////////////////////////////////////////////// // // -// OPTIONS FOR SEGMENTED_VECTOR CONTAINERS +// OPTIONS FOR SEGTOR CONTAINERS // // //////////////////////////////////////////////////////////////// @@ -708,25 +708,25 @@ using deque_options_t = typename boost::container::deque_options::ty #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template -struct segmented_vector_opt : public deque_opt +struct segtor_opt : public deque_opt {}; -typedef segmented_vector_opt<0u, 0u, void, false> segmented_vector_null_opt; +typedef segtor_opt<0u, 0u, void, false> segtor_null_opt; #endif //! Helper metafunction to combine options into a single type to be used -//! by \c boost::container::segmented_vector. +//! by \c boost::container::segtor. //! Supported options are: \c boost::container::block_bytes / \c boost::container::segment_bytes, //! \c boost::container::block_size / \c boost::container::segment_size, //! \c boost::container::stored_size #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) template -struct segmented_vector_options +struct segtor_options : deque_options #else template -struct segmented_vector_options +struct segtor_options : deque_options #endif {}; @@ -734,9 +734,9 @@ struct segmented_vector_options #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) //! Helper alias metafunction to combine options into a single type to be used -//! by \c boost::container::segmented_vector. +//! by \c boost::container::segtor. template -using segmented_vector_options_t = typename boost::container::segmented_vector_options::type; +using segtor_options_t = typename boost::container::segtor_options::type; #endif @@ -808,7 +808,7 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(segment_bytes, std::size_t, SegmentBytes, block_ //!This option specifies the size of a block, delimites the number of contiguous elements (BlockSize) //!that will be allocated by segmented containers. -//!For some containers (like deque/segmented_vector), a power of two value can improve performance. +//!For some containers (like deque/segtor), a power of two value can improve performance. //!A value zero represents the default value. //! //!\tparam BlockBytes An unsigned integer value. @@ -823,7 +823,7 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(segment_size, std::size_t, SegmentSize, block_si //!This option specifies if the container has reserve/capacity-like features //! -//!For some containers (like deque/segmented_vector) this option might change the internal representation or +//!For some containers (like deque/segtor) this option might change the internal representation or //!behavior so that memory for elements can be allocated in advance in //!order to improve performance. //! diff --git a/include/boost/container/pmr/segmented_vector.hpp b/include/boost/container/pmr/segtor.hpp similarity index 66% rename from include/boost/container/pmr/segmented_vector.hpp rename to include/boost/container/pmr/segtor.hpp index 72dff94..fa493dd 100644 --- a/include/boost/container/pmr/segmented_vector.hpp +++ b/include/boost/container/pmr/segtor.hpp @@ -8,14 +8,14 @@ // ////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_PMR_SEGMENTED_VECTOR_HPP -#define BOOST_CONTAINER_PMR_SEGMENTED_VECTOR_HPP +#ifndef BOOST_CONTAINER_PMR_SEGTOR_HPP +#define BOOST_CONTAINER_PMR_SEGTOR_HPP #if defined (_MSC_VER) # pragma once #endif -#include +#include #include namespace boost { @@ -25,16 +25,16 @@ namespace pmr { #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) template -using segmented_vector = boost::container::segmented_vector>; +using segtor = boost::container::segtor>; #endif -//! A portable metafunction to obtain a segmented_vector +//! A portable metafunction to obtain a segtor //! that uses a polymorphic allocator. template -struct segmented_vector_of +struct segtor_of { - typedef boost::container::segmented_vector + typedef boost::container::segtor < T, polymorphic_allocator > type; }; @@ -42,4 +42,4 @@ struct segmented_vector_of } //namespace container { } //namespace boost { -#endif //BOOST_CONTAINER_PMR_SEGMENTED_VECTOR_HPP +#endif //BOOST_CONTAINER_PMR_SEGTOR_HPP diff --git a/include/boost/container/segmented_vector.hpp b/include/boost/container/segtor.hpp similarity index 86% rename from include/boost/container/segmented_vector.hpp rename to include/boost/container/segtor.hpp index bc0e417..d54292c 100644 --- a/include/boost/container/segmented_vector.hpp +++ b/include/boost/container/segtor.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2025. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2026. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -8,8 +8,8 @@ // ////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_SEGMENTED_VECTOR_HPP -#define BOOST_CONTAINER_SEGMENTED_VECTOR_HPP +#ifndef BOOST_CONTAINER_SEGTOR_HPP +#define BOOST_CONTAINER_SEGTOR_HPP #ifndef BOOST_CONFIG_HPP # include @@ -27,27 +27,26 @@ namespace boost { namespace container { #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -//! A segmented vector is a sequence container that supports random access to elements, -//! constant time insertion and removal of elements at the end, and linear time -//! insertion and removal of elements in the middle. It uses the same segmented -//! (block-based) storage as deque but only allows growth at the back. +//! A segtor (contraction of "segmented vector" is a sequence container that supports +//! random access to elements, constant time insertion and removal of elements at +//! the end, and linear time insertion and removal of elements in the middle. //! -//! This is the single-ended version of boost::container::deque: it provides +//! It's the single-ended version of boost::container::deque: it provides //! push_back, pop_back, emplace_back, etc., but does not provide push_front, //! pop_front, or emplace_front. //! -//! \tparam T The type of object that is stored in the segmented_vector +//! \tparam T The type of object that is stored in the segtor //! \tparam Allocator The allocator used for all internal memory management, use void //! for the default allocator -//! \tparam Options A type produced from \c boost::container::segmented_vector_options. +//! \tparam Options A type produced from \c boost::container::segtor_options. template #else template #endif -class segmented_vector : public deque_impl +class segtor : public deque_impl { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - BOOST_COPYABLE_AND_MOVABLE(segmented_vector) + BOOST_COPYABLE_AND_MOVABLE(segtor) typedef deque_impl base_type; #endif @@ -84,37 +83,37 @@ class segmented_vector : public deque_impl // ////////////////////////////////////////////// - //! Effects: Default constructs a segmented_vector. + //! Effects: Default constructs a segtor. //! //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - segmented_vector() + segtor() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : base_type() {} - //! Effects: Constructs a segmented_vector taking the allocator as parameter. + //! Effects: Constructs a segtor taking the allocator as parameter. //! //! Throws: Nothing //! //! Complexity: Constant. - explicit segmented_vector(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW + explicit segtor(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW : base_type(a) {} - //! Effects: Constructs a segmented_vector + //! Effects: Constructs a segtor //! and inserts n value initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's value initialization throws. //! //! Complexity: Linear to n. - explicit segmented_vector(size_type n) + explicit segtor(size_type n) : base_type(n) {} - //! Effects: Constructs a segmented_vector + //! Effects: Constructs a segtor //! and inserts n default initialized values. //! //! Throws: If allocator_type's default constructor @@ -123,22 +122,22 @@ class segmented_vector : public deque_impl //! Complexity: Linear to n. //! //! Note: Non-standard extension - segmented_vector(size_type n, default_init_t) + segtor(size_type n, default_init_t) : base_type(n, default_init) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n value initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's value initialization throws. //! //! Complexity: Linear to n. - explicit segmented_vector(size_type n, const allocator_type& a) + explicit segtor(size_type n, const allocator_type& a) : base_type(n, a) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n default initialized values. //! //! Throws: If allocator_type's default constructor @@ -147,33 +146,33 @@ class segmented_vector : public deque_impl //! Complexity: Linear to n. //! //! Note: Non-standard extension - segmented_vector(size_type n, default_init_t, const allocator_type& a) + segtor(size_type n, default_init_t, const allocator_type& a) : base_type(n, default_init, a) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n copies of value. //! //! Throws: If allocator_type's default constructor //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - segmented_vector(size_type n, const value_type& value) + segtor(size_type n, const value_type& value) : base_type(n, value) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n copies of value. //! //! Throws: If allocator_type's default constructor //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - segmented_vector(size_type n, const value_type& value, const allocator_type& a) + segtor(size_type n, const value_type& value, const allocator_type& a) : base_type(n, value, a) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [first, last). //! //! Throws: If allocator_type's default constructor @@ -181,7 +180,7 @@ class segmented_vector : public deque_impl //! //! Complexity: Linear to the range [first, last). template - segmented_vector(InIt first, InIt last + segtor(InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible::type* = 0 #endif @@ -189,7 +188,7 @@ class segmented_vector : public deque_impl : base_type(first, last) {} - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [first, last). //! //! Throws: If allocator_type's default constructor @@ -197,7 +196,7 @@ class segmented_vector : public deque_impl //! //! Complexity: Linear to the range [first, last). template - segmented_vector(InIt first, InIt last, const allocator_type& a + segtor(InIt first, InIt last, const allocator_type& a #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible::type* = 0 #endif @@ -206,24 +205,24 @@ class segmented_vector : public deque_impl {} #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! Effects: Constructs a segmented_vector that will use a copy of allocator a + //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [il.begin(), il.end()). //! //! Throws: If allocator_type's default constructor //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws. //! //! Complexity: Linear to the range [il.begin(), il.end()). - segmented_vector(std::initializer_list il, const allocator_type& a = allocator_type()) + segtor(std::initializer_list il, const allocator_type& a = allocator_type()) : base_type(il, a) {} #endif - //! Effects: Copy constructs a segmented_vector. + //! Effects: Copy constructs a segtor. //! //! Postcondition: x == *this. //! //! Complexity: Linear to the elements x contains. - segmented_vector(const segmented_vector& x) + segtor(const segtor& x) : base_type(x) {} @@ -232,11 +231,11 @@ class segmented_vector : public deque_impl //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - segmented_vector(BOOST_RV_REF(segmented_vector) x) BOOST_NOEXCEPT_OR_NOTHROW + segtor(BOOST_RV_REF(segtor) x) BOOST_NOEXCEPT_OR_NOTHROW : base_type(boost::move(static_cast(x))) {} - //! Effects: Copy constructs a segmented_vector using the specified allocator. + //! Effects: Copy constructs a segtor using the specified allocator. //! //! Postcondition: x == *this. //! @@ -244,7 +243,7 @@ class segmented_vector : public deque_impl //! throws or T's copy constructor throws. //! //! Complexity: Linear to the elements x contains. - segmented_vector(const segmented_vector& x, const allocator_type& a) + segtor(const segtor& x, const allocator_type& a) : base_type(x, a) {} @@ -255,17 +254,17 @@ class segmented_vector : public deque_impl //! Throws: If allocation or T's copy constructor throws. //! //! Complexity: Constant if a == x.get_allocator(), linear otherwise. - segmented_vector(BOOST_RV_REF(segmented_vector) x, const allocator_type& a) + segtor(BOOST_RV_REF(segtor) x, const allocator_type& a) : base_type(boost::move(static_cast(x)), a) {} - //! Effects: Destroys the segmented_vector. All stored values are destroyed + //! Effects: Destroys the segtor. All stored values are destroyed //! and used memory is deallocated. //! //! Throws: Nothing. //! //! Complexity: Linear to the number of elements. - ~segmented_vector() BOOST_NOEXCEPT_OR_NOTHROW + ~segtor() BOOST_NOEXCEPT_OR_NOTHROW {} //! Effects: Makes *this contain the same elements as x. @@ -276,7 +275,7 @@ class segmented_vector : public deque_impl //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - segmented_vector& operator=(BOOST_COPY_ASSIGN_REF(segmented_vector) x) + segtor& operator=(BOOST_COPY_ASSIGN_REF(segtor) x) { base_type::operator=(static_cast(x)); return *this; @@ -290,7 +289,7 @@ class segmented_vector : public deque_impl //! Complexity: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get_allocator() == x.get_allocator(). Linear otherwise. - segmented_vector& operator=(BOOST_RV_REF(segmented_vector) x) + segtor& operator=(BOOST_RV_REF(segtor) x) BOOST_NOEXCEPT_IF(allocator_traits::propagate_on_container_move_assignment::value || allocator_traits::is_always_equal::value) { @@ -307,7 +306,7 @@ class segmented_vector : public deque_impl //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in il. - segmented_vector& operator=(std::initializer_list il) + segtor& operator=(std::initializer_list il) { base_type::operator=(il); return *this; @@ -790,55 +789,55 @@ class segmented_vector : public deque_impl //! Throws: Nothing. //! //! Complexity: Constant. - void swap(segmented_vector& x); + void swap(segtor& x); #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator==(const segmented_vector& x, const segmented_vector& y) + friend bool operator==(const segtor& x, const segtor& y) { return static_cast(x) == static_cast(y); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator!=(const segmented_vector& x, const segmented_vector& y) + friend bool operator!=(const segtor& x, const segtor& y) { return static_cast(x) != static_cast(y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator<(const segmented_vector& x, const segmented_vector& y) + friend bool operator<(const segtor& x, const segtor& y) { return static_cast(x) < static_cast(y); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator>(const segmented_vector& x, const segmented_vector& y) + friend bool operator>(const segtor& x, const segtor& y) { return static_cast(x) > static_cast(y); } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator<=(const segmented_vector& x, const segmented_vector& y) + friend bool operator<=(const segtor& x, const segtor& y) { return static_cast(x) <= static_cast(y); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline - friend bool operator>=(const segmented_vector& x, const segmented_vector& y) + friend bool operator>=(const segtor& x, const segtor& y) { return static_cast(x) >= static_cast(y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - inline friend void swap(segmented_vector& x, segmented_vector& y) + inline friend void swap(segtor& x, segtor& y) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) { static_cast(x).swap(static_cast(y)); } @@ -848,12 +847,12 @@ class segmented_vector : public deque_impl #ifndef BOOST_CONTAINER_NO_CXX17_CTAD template -segmented_vector(InputIterator, InputIterator) -> - segmented_vector::type>; +segtor(InputIterator, InputIterator) -> + segtor::type>; template -segmented_vector(InputIterator, InputIterator, Allocator const&) -> - segmented_vector::type, Allocator>; +segtor(InputIterator, InputIterator, Allocator const&) -> + segtor::type, Allocator>; #endif @@ -861,9 +860,9 @@ segmented_vector(InputIterator, InputIterator, Allocator const&) -> //! //! Complexity: Linear. template -inline typename segmented_vector::size_type erase(segmented_vector& c, const U& v) +inline typename segtor::size_type erase(segtor& c, const U& v) { - typename segmented_vector::size_type old_size = c.size(); + typename segtor::size_type old_size = c.size(); c.erase(boost::container::remove(c.begin(), c.end(), v), c.end()); return old_size - c.size(); } @@ -872,9 +871,9 @@ inline typename segmented_vector::size_type erase(segmented_vectorComplexity: Linear. template -inline typename segmented_vector::size_type erase_if(segmented_vector& c, Pred pred) +inline typename segtor::size_type erase_if(segtor& c, Pred pred) { - typename segmented_vector::size_type old_size = c.size(); + typename segtor::size_type old_size = c.size(); c.erase(boost::container::remove_if(c.begin(), c.end(), pred), c.end()); return old_size - c.size(); } @@ -887,7 +886,7 @@ inline typename segmented_vector::size_type erase_if(segmented_vector -struct has_trivial_destructor_after_move > +struct has_trivial_destructor_after_move > : has_trivial_destructor_after_move > {}; @@ -897,4 +896,4 @@ struct has_trivial_destructor_after_move -#endif //#ifndef BOOST_CONTAINER_SEGMENTED_VECTOR_HPP +#endif //#ifndef BOOST_CONTAINER_SEGTOR_HPP diff --git a/test/segmented_vector_options_test.cpp b/test/segmented_vector_options_test.cpp deleted file mode 100644 index 25c7a09..0000000 --- a/test/segmented_vector_options_test.cpp +++ /dev/null @@ -1,106 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2025. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include - -using namespace boost::container; - -template -void test_stored_size_type_impl() -{ - #ifndef BOOST_NO_EXCEPTIONS - VectorType v; - typedef typename VectorType::size_type size_type; - size_type const max = Unsigned(-1); - v.resize(5); - BOOST_TEST_THROWS(v.resize(max+1), std::exception); - BOOST_TEST_THROWS(VectorType v2(max+1), std::exception); - #endif -} - -template -void test_stored_size_type() -{ - #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - using options_t = segmented_vector_options_t< stored_size >; - #else - typedef typename segmented_vector_options - < stored_size >::type options_t; - #endif - - typedef segmented_vector > default_segmented_vector_t; - { - typedef segmented_vector, options_t> segmented_vector_t; - BOOST_CONTAINER_STATIC_ASSERT(sizeof(segmented_vector_t) < sizeof(default_segmented_vector_t)); - test_stored_size_type_impl(); - } - { - typedef segmented_vector, options_t> segmented_vector_t; - BOOST_CONTAINER_STATIC_ASSERT(sizeof(segmented_vector_t) < sizeof(default_segmented_vector_t)); - test_stored_size_type_impl(); - } -} - -void test_block_bytes() -{ - #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - using options_t = segmented_vector_options_t< block_bytes<128u> >; - #else - typedef segmented_vector_options< block_bytes<128u> >::type options_t; - #endif - typedef segmented_vector segmented_vector_t; - BOOST_TEST(segmented_vector_t::get_block_size() == 128u/sizeof(unsigned short)); -} - -void test_block_elements() -{ - #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - using options_t = segmented_vector_options_t< block_size<64> >; - #else - typedef segmented_vector_options< block_size<64> >::type options_t; - #endif - typedef segmented_vector segmented_vector_t; - BOOST_TEST(segmented_vector_t::get_block_size() == 64U); -} - -void test_reservable() -{ - { - #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - using options_t = segmented_vector_options_t< reservable >; - #else - typedef segmented_vector_options< reservable >::type options_t; - #endif - typedef segmented_vector segmented_vector_t; - BOOST_CONTAINER_STATIC_ASSERT(segmented_vector_t::is_reservable == true); - } - { - #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - using options_t = segmented_vector_options_t< reservable >; - #else - typedef segmented_vector_options< reservable >::type options_t; - #endif - typedef segmented_vector segmented_vector_t; - BOOST_CONTAINER_STATIC_ASSERT(segmented_vector_t::is_reservable == false); - } -} - -int main() -{ - test_block_bytes(); - test_block_elements(); - test_stored_size_type(); - test_stored_size_type(); - test_reservable(); - return ::boost::report_errors(); -} diff --git a/test/segtor_options_test.cpp b/test/segtor_options_test.cpp new file mode 100644 index 0000000..d8ad3b4 --- /dev/null +++ b/test/segtor_options_test.cpp @@ -0,0 +1,106 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2026. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + +using namespace boost::container; + +template +void test_stored_size_type_impl() +{ + #ifndef BOOST_NO_EXCEPTIONS + VectorType v; + typedef typename VectorType::size_type size_type; + size_type const max = Unsigned(-1); + v.resize(5); + BOOST_TEST_THROWS(v.resize(max+1), std::exception); + BOOST_TEST_THROWS(VectorType v2(max+1), std::exception); + #endif +} + +template +void test_stored_size_type() +{ + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + using options_t = segtor_options_t< stored_size >; + #else + typedef typename segtor_options + < stored_size >::type options_t; + #endif + + typedef segtor > default_segtor_t; + { + typedef segtor, options_t> segtor_t; + BOOST_CONTAINER_STATIC_ASSERT(sizeof(segtor_t) < sizeof(default_segtor_t)); + test_stored_size_type_impl(); + } + { + typedef segtor, options_t> segtor_t; + BOOST_CONTAINER_STATIC_ASSERT(sizeof(segtor_t) < sizeof(default_segtor_t)); + test_stored_size_type_impl(); + } +} + +void test_block_bytes() +{ + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + using options_t = segtor_options_t< block_bytes<128u> >; + #else + typedef segtor_options< block_bytes<128u> >::type options_t; + #endif + typedef segtor segtor_t; + BOOST_TEST(segtor_t::get_block_size() == 128u/sizeof(unsigned short)); +} + +void test_block_elements() +{ + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + using options_t = segtor_options_t< block_size<64> >; + #else + typedef segtor_options< block_size<64> >::type options_t; + #endif + typedef segtor segtor_t; + BOOST_TEST(segtor_t::get_block_size() == 64U); +} + +void test_reservable() +{ + { + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + using options_t = segtor_options_t< reservable >; + #else + typedef segtor_options< reservable >::type options_t; + #endif + typedef segtor segtor_t; + BOOST_CONTAINER_STATIC_ASSERT(segtor_t::is_reservable == true); + } + { + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + using options_t = segtor_options_t< reservable >; + #else + typedef segtor_options< reservable >::type options_t; + #endif + typedef segtor segtor_t; + BOOST_CONTAINER_STATIC_ASSERT(segtor_t::is_reservable == false); + } +} + +int main() +{ + test_block_bytes(); + test_block_elements(); + test_stored_size_type(); + test_stored_size_type(); + test_reservable(); + return ::boost::report_errors(); +} diff --git a/test/segmented_vector_test.cpp b/test/segtor_test.cpp similarity index 75% rename from test/segmented_vector_test.cpp rename to test/segtor_test.cpp index ff702a8..65d8c37 100644 --- a/test/segmented_vector_test.cpp +++ b/test/segtor_test.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include @@ -36,15 +36,15 @@ using namespace boost::container; //Function to check if both sets are equal -// segmented_vector does not provide front operations; only back/middle tests +// segtor does not provide front operations; only back/middle tests template -bool segmented_vector_copyable_only(V1 &, V2 &, dtl::false_type) +bool segtor_copyable_only(V1 &, V2 &, dtl::false_type) { return true; } template -bool segmented_vector_copyable_only(V1 &cntc, V2 &stdc, dtl::true_type) +bool segtor_copyable_only(V1 &cntc, V2 &stdc, dtl::true_type) { typedef typename V1::value_type IntType; std::size_t size = cntc.size(); @@ -96,36 +96,36 @@ bool segmented_vector_copyable_only(V1 &cntc, V2 &stdc, dtl::true_type) } //Test recursive structures -class recursive_segmented_vector +class recursive_segtor { public: - recursive_segmented_vector (const recursive_segmented_vector &x) - : segmented_vector_(x.segmented_vector_) + recursive_segtor (const recursive_segtor &x) + : segtor_(x.segtor_) {} - recursive_segmented_vector & operator=(const recursive_segmented_vector &x) - { this->segmented_vector_ = x.segmented_vector_; return *this; } + recursive_segtor & operator=(const recursive_segtor &x) + { this->segtor_ = x.segtor_; return *this; } - segmented_vector segmented_vector_; - segmented_vector::iterator it_; - segmented_vector::const_iterator cit_; - segmented_vector::reverse_iterator rit_; - segmented_vector::const_reverse_iterator crit_; + segtor segtor_; + segtor::iterator it_; + segtor::const_iterator cit_; + segtor::reverse_iterator rit_; + segtor::const_reverse_iterator crit_; }; -bool do_recursive_segmented_vector_test() +bool do_recursive_segtor_test() { //Test for recursive types { - segmented_vector recursive_segmented_vector_segmented_vector; + segtor recursive_segtor_segtor; } { //Now test move semantics - segmented_vector original; - segmented_vector move_ctor(boost::move(original)); - segmented_vector move_assign; + segtor original; + segtor move_ctor(boost::move(original)); + segtor move_assign; move_assign = boost::move(move_ctor); move_assign.swap(original); } @@ -135,15 +135,15 @@ bool do_recursive_segmented_vector_test() template bool do_test() { - typedef typename segmented_vector_options >::type Options; + typedef typename segtor_options >::type Options; { - typedef segmented_vector MyCnt; + typedef segtor MyCnt; ::boost::movelib::unique_ptr const pcntc = ::boost::movelib::make_unique(); pcntc->erase(pcntc->cbegin(), pcntc->cend()); } //Alias types - typedef segmented_vector MyCnt; + typedef segtor MyCnt; typedef std::vector MyStd; const int max = 100; { @@ -258,7 +258,7 @@ bool do_test() if(!test::CheckEqualContainers(cntc, stdc)) return false; } - if(!segmented_vector_copyable_only(cntc, stdc + if(!segtor_copyable_only(cntc, stdc ,dtl::bool_::value>())){ return false; } @@ -306,12 +306,12 @@ bool test_ctad() //Older clang versions suffer from ICE here //Check Constructor Template Auto Deduction { MyStd gold = MyStd{ 1, 2, 3 }; - segmented_vector test = segmented_vector(gold.begin(), gold.end()); + segtor test = segtor(gold.begin(), gold.end()); if (!test::CheckEqualContainers(gold, test)) return false; } { MyStd gold = MyStd{ 1, 2, 3 }; - segmented_vector test = segmented_vector(gold.begin(), gold.end(), new_allocator()); + segtor test = segtor(gold.begin(), gold.end(), new_allocator()); if (!test::CheckEqualContainers(gold, test)) return false; } return true; @@ -326,10 +326,10 @@ struct GetAllocatorCont template struct apply { - typedef segmented_vector< ValueType + typedef segtor< ValueType , typename allocator_traits ::template portable_rebind_alloc::type - , typename segmented_vector_options >::type + , typename segtor_options >::type > type; }; }; @@ -365,56 +365,56 @@ struct char_holder bool do_test_default_block_size() { //Check power of two sizes by default - BOOST_TEST(segmented_vector >::get_block_size() == 16*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 16*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 8*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 8*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 8*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 8*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 4*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); - BOOST_TEST(segmented_vector >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 16*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 16*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 8*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 8*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 8*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 8*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 4*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); + BOOST_TEST(segtor >::get_block_size() == 2*sizeof(void*)); //Minimal 8 elements - BOOST_TEST(segmented_vector >::get_block_size() == 8u); + BOOST_TEST(segtor >::get_block_size() == 8u); return 0 == boost::report_errors(); } -struct boost_container_segmented_vector; +struct boost_container_segtor; namespace boost { namespace container { namespace test { template<> -struct alloc_propagate_base +struct alloc_propagate_base { template struct apply { - typedef boost::container::segmented_vector type; + typedef boost::container::segtor type; }; }; }}} //namespace boost::container::test -//Test segmented_vector has the expected size --> 3 words -BOOST_CONTAINER_STATIC_ASSERT_MSG(3*sizeof(void*) == sizeof(segmented_vector), "sizeof(segmented_vector should be 3 words"); +//Test segtor has the expected size --> 3 words +BOOST_CONTAINER_STATIC_ASSERT_MSG(3*sizeof(void*) == sizeof(segtor), "sizeof(segtor should be 3 words"); int main () { - if(!do_recursive_segmented_vector_test()) + if(!do_recursive_segtor_test()) return 1; if(!do_test()) @@ -438,7 +438,7 @@ int main () //Test non-copy-move operations (back only; no emplace_front) { - segmented_vector d; + segtor d; d.emplace_back(); d.emplace_back(1); d.resize(10); @@ -463,7 +463,7 @@ int main () //////////////////////////////////// // Default init test //////////////////////////////////// - if(!test::default_init_test< segmented_vector > >()){ + if(!test::default_init_test< segtor > >()){ std::cerr << "Default init test failed" << std::endl; return 1; } @@ -471,23 +471,23 @@ int main () //////////////////////////////////// // Emplace testing //////////////////////////////////// - // segmented_vector does not provide front operations (emplace_front, push_front, pop_front) + // segtor does not provide front operations (emplace_front, push_front, pop_front) const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE); if(!boost::container::test::test_emplace - < segmented_vector, Options>()) + < segtor, Options>()) return 1; //////////////////////////////////// // Allocator propagation testing //////////////////////////////////// - if(!boost::container::test::test_propagate_allocator()) + if(!boost::container::test::test_propagate_allocator()) return 1; //////////////////////////////////// // Initializer lists testing //////////////////////////////////// if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for - < boost::container::segmented_vector >()) { + < boost::container::segtor >()) { return 1; } @@ -495,7 +495,7 @@ int main () // Iterator testing //////////////////////////////////// { - typedef boost::container::segmented_vector cont_int; + typedef boost::container::segtor cont_int; for(std::size_t i = 1; i <= 10000; i*=10){ cont_int a; for (int j = 0; j < (int)i; ++j) @@ -512,7 +512,7 @@ int main () //////////////////////////////////// // default allocator { - typedef boost::container::segmented_vector cont; + typedef boost::container::segtor cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; BOOST_CONTAINER_STATIC_ASSERT_MSG(!(boost::has_trivial_destructor_after_move::value != @@ -522,7 +522,7 @@ int main () } // std::allocator { - typedef boost::container::segmented_vector > cont; + typedef boost::container::segtor > cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; BOOST_CONTAINER_STATIC_ASSERT_MSG(!(boost::has_trivial_destructor_after_move::value !=