Namespaces
Variants

std::hive

From cppreference.com
Defined in header <hive>
template<
    class T,
    class Allocator = std::allocator<T>
> class hive;
(1) (since C++26)
namespace pmr {
    template<class T>
    using hive = std::hive<T, std::pmr::polymorphic_allocator<T>>;
}
(2) (since C++26)


1) std::hive is a sequence container that provides constant-time insertion and erasure operations.
2) std::pmr::hive is an alias template that uses a polymorphic allocator.

Storage is automatically managed in multiple memory blocks, referred to as element blocks. Insertion position is determined by the container, and insertion may re-use the memory locations of erased elements.

Element blocks which contain elements are referred to as active blocks, those which do not are referred to as reserved blocks. Active blocks which become empty of elements are either deallocated or become reserved blocks. Reserved blocks become active blocks when they are used to store elements. A user can create additional reserved blocks by calling reserve().

Erasures use unspecified techniques of constant time complexity to identify the memory locations of erased elements, which are subsequently skipped during iteration, as opposed to relocating subsequent elements during erasure.

Active block capacities have an implementation-defined growth factor (which need not be integral), for example a new active block's capacity could be equal to the summed capacities of the pre-existing active blocks.

Limits can be placed on both the minimum and maximum element capacities of element blocks, both by users and implementations.

A std::hive conforms to the requirements of Container, with the exception of operators == and !=. A std::hive also meets the requirements of ReversibleContainer, of AllocatorAwareContainer, and some of the requirements of SequenceContainer.