![]() |
Home | Libraries | People | FAQ | More |
Boost.Container is a product of a long development
effort that started in
2004 with the experimental Shmem library, which pioneered the use
of standard containers in shared memory. Shmem included modified SGI STL
container code tweaked to support non-raw allocator::pointer
types and stateful allocators. Once reviewed, Shmem was accepted as Boost.Interprocess
and this library continued to refine and improve those containers.
In 2007, container code from node containers (map,
list, slist)
was rewritten, refactored and expanded to build the intrusive container library
Boost.Intrusive.
Boost.Interprocess containers were refactored
to take advantage of Boost.Intrusive containers
and code duplication was minimized. Both libraries continued to gain support
and bug fixes for years. They introduced move semantics, emplacement insertion
and more features of then unreleased C++0x standard.
Boost.Interprocess containers were always
standard compliant, and those containers and new containers like stable_vector and flat_[multi]set/map were used outside Boost.Interprocess
with success. As containers were mature enough to get their own library,
it was a natural step to collect them containers and build Boost.Container,
a library targeted to a wider audience.
flat_[multi]_map/set containers were originally based
on Loki's
AssocVector class. Code was rewritten and expanded for Boost.Interprocess,
so thanks to Andrei Alexandrescu.
stable_vector was invented
and coded by Joaquín
M. López Muñoz, then adapted for Boost.Interprocess.
Thanks for such a great container.
static_vector was based
on Andrew Hundt's and Adam Wulkiewicz's high-performance varray class. Many performance improvements
of vector were also inspired
by their implementation. Thanks!
devector's initial implementation
is based on Thaler Benedek's high-performance devector
implementation, then adapted for Boost.Container.
Also inspired by similar implemenations by Orson Peters and Lars Hagen.
Thanks for such a great code and documentation!
stable_vector
has the splice overloads
of list. They transfer
elements between two stable_vectors
with equal allocators, or inside one stable_vector,
without copying, moving or destroying them (GitHub
#349: "stable_vector: add the splice() overloads of
std::list").
stable_vector
has the unique, merge, sort
and reverse members
of list. They do not
copy or move the elements, so pointers, refernces, and iterators remain
valid.
slist
is now a linear list: the last node points to null instead of the header.
Move construction, move assignment, swap and the allocator-extended
move constructor with equal allocators now take constant time instead
of linear time. before_begin() is no longer equal to end(),
and previous(begin())
returns before_begin(). Breaking change:
the representation in memory changes, so a slist
placed in shared memory or in a mapped file by a previous Boost version
can not be used by this version, and the reverse. Define BOOST_CONTAINER_CIRCULAR_SLIST to
get the previous circular representation. This macro is deprecated
and a compilation message is shown when it is used (BOOST_DISABLE_PRAGMA_MESSAGE
hides it).
map
and set, insert(const_iterator hint, node_type&& nh), now returns iterator
instead of insert_return_type.
If the insertion fails, nh
keeps the node, and the returned iterator points to the element with
an equivalent key. Before, the node moved to the node
member of the returned insert_return_type
and nh was empty.
insert(node_type&&
nh)
without a hint still returns insert_return_type.
The change follows the interface of the standard associative containers,
which the previous versions did not implement correctly by mistake.
Define BOOST_CONTAINER_HINT_NODE_INSERT_RETURNS_INSERT_RETURN_TYPE
to get the previous behaviour. This macro is deprecated and a compilation
message is shown when it is used (BOOST_DISABLE_PRAGMA_MESSAGE
hides it).
monotonic_buffer_resource.
polymorphic_allocator,
scoped_allocator_adaptor
and internal utilities are trivially copyable when their members are.
This allows some compilers to pass and return them in registers.
noexcept
when allocator_traits<Allocator>::is_always_equal
is true (as an extension to the standardvector,
devector,
deque, segtor, list,
slist, stable_vector, basic_string, hub. map,
multimap,
set and multiset also need a comparator
with a non-throwing copy constructor.
devector: the
relocate_never
option, documented in previous releases, is now implemented. The elements
are never relocated inside the buffer: an insertion at a full end always
allocates a new buffer. With this option push_back,
push_front, emplace_back and emplace_front
give the strong exception guarantee.
noexcept specifications:
incorrect conditions in move constructors and move assignments
of vector, small_vector, static_vector, devector, set
and map, and
functions that can throw but were marked noexcept.
small_vector
move and swap with unequal allocators, vector
move assignment.
stable_vector,
deque, list, slist,
basic_string
and nest.
stable_vector
and deque, and
a non-linear erase_if
in flat containers.
hub container
designed by Joaquín M. López Muñoz. See Hub
Container chapter for more information.
unchecked_emplace_back
and unchecked_push_back
to vector, static_vector and
small_vector.
static_vector<T>'s destructor is now trivial if
T is trivial.
uninitialized_construct_using_allocator
and make_obj_using_allocator.
[[nodiscard]] to several allocator and PMR utilities.
new_allocator
and pmr::new_delete_resource():
__cpp_aligned_new feature.
posix_memalign, aligned_alloc, _aligned_malloc...) otherwise.
adaptive_pooland
node_allocator
erase/erase_if/unique
members of list and
slist to size_type to follow C++20 changes
to std::list.
basic_string:
string_view
members and updated operator[] to be able to return the terminating
null.
starts_with/ends_with and C++23 contains overloads.
basic_string
methods taking const CharT*
parameters.
std::nullptr_t.
inline_chars,
growth_factor
and stored_size
options to basic_string.
segtor
container: the single ended brother of deque:
a random-access sequence container with segmented (block-based)
storage like deque but only growth at the back.
boost::container::deque.
The original implementation was based on the SGI's original data structure
(similar to libstdc++). Main changes:
sizeof(deque)
was 10 words, now is 4 words. Probably the lightest implementation
around.
sizeof(deque::iterator)
was 4 words, now is is 2 words (similar to libc++ and MSVC).
stored_size
option to static_vector
and small_vector.
devector's
insertion logic has been reimplemented to move elements to the center
of the devector if an insertion at one end has no free capacity but
there is free capacity on the other end. Current implementation keeps
reallocating memory when only inserting at one end and poping from
the other, provoking very high memory usage. The new strategy is based
on the article Double-ended
vector - is it useful? by Lars Greger Nordland Hagen.
boost/container/vector.hpp preprocessed file size reduces
from 1,5MB to 930KB. If you still want to use standard exception classes,
you can define BOOST_CONTAINER_USE_STD_EXCEPTIONS
before using any Boost.Container class.
pmr::map with a std::pair;
works when using a std::tuple".
devector
container.
equal_range can result in a
range with length greater than 1".
deque can now
have options, using deque_options.
The block size/bytes can be be specified.
static_vector
can now have options, using static_vector_options.
Alignment and throwing behaviour can be be specified.
small_vector
can now have options, using small_vector_options.
Alignment and growth factor can be be specified.
new_allocator<T> to void
to reduce symbol lenghts.
contains() for associative containers as specified
in P0458R2:
Checking for Existence of an Element in Associative Containers.
adaptive_pool
and many parameters are now compile-time constants instead of runtime
constants.
[multi]map/[multi]set/flat_[multi]map/flat_[multi]set.
unsynchronized_pool_resource
found by Arthur O'Dowyer in his blog post <memory_resource>
for libc++
release()
the original buffer is recovered for the next allocation.
vector_options.
The growth factor and the stored size type can be specified.
extract_sequence,
adopt_sequence functions
for flat_[multi]map/set associative containers.
static_vector<>::static_capacity
to use the configured capacity in constant expressions.
insert_or_assign/try_emplace for map
and flat_map.
map,
multimap,
set, multiset.
deque,
vector, stable_vector, small_vector,
static_vector, list and slist.
boost::container::small_vector
supports more constructors and assignments.
pop_back, pop_front, back,
front, etc.)
back/front operations to basic_string.
small_vector
container.
nth and index_of functions to containers
with random-access iterators (except basic_string).
allocator_traits<Allocator>::is_always_equal.
scoped_allocator_adaptor's
propagate_on_container_copy_assignment,
propagate_on_container_move_assignment
and propagate_on_container_swap
are no longer ::boost::integral_constant<bool, true/false> types. The dependency reorganization
needed to break with those classes to avoid MPL dependencies, and interoperability
with std::integral_constant was not guaranteed.
Code assumming boost::true_type/boost::false_type
on this will not compile. As a workaround, use the guaranteed internal
::value
constant: ::boost::integral_constant<bool, scoped_allocator_adaptor<Allocator>::propagate_on_container_move_assignment::value>.
initializer_list.
Contributed by Robert Matusewicz.
set, multiset,
map and multimap.
static_vector
class, based on Andrew Hundt's and Adam Wulkiewicz's high performance
varray class.
vector
constructors/copy/move/swap, dispatching to memcpy when possible.
BOOST_NO_EXCEPTIONS
#7227.
vector's insertion
performance.
stable_vector's
template code bloat and type safety.