Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
object::object (11 of 11 overloads)

Construct from initializer-list.

Synopsis
object(
    std::initializer_list< std::pair< string_view, value_ref >> init,
    std::size_t min_capacity,
    storage_ptr sp = {});
Description

Storage for at least min_capacity elements is reserved, and then the object is constructed with a copy of the values in the initializer-list in order, using the specified memory resource. If there are elements with duplicate keys; that is, if multiple elements in the range have keys that compare equal, only the first equivalent element will be inserted.

Complexity

Linear in init.size().

Exception Safety

Strong guarantee. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

init

The initializer list to insert.

min_capacity

The minimum number of elements for which capacity is guaranteed without a subsequent reallocation. Upon construction, capacity() will be greater than or equal to this number.

sp

A pointer to the memory_resource to use. The container will acquire shared ownership of the memory resource.


PrevUpHomeNext