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 (4 of 11 overloads)

Constructor.

Synopsis
template<
    class InputIt>
object(
    InputIt first,
    InputIt last,
    std::size_t min_capacity = 0,
    storage_ptr sp = {});
Description

The object is constructed with the elements in the range {first, last), preserving 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.

Constraints
std::is_constructible_v<
    key_value_pair,
    std::iterator_traits<InputIt>::value_type>
Complexity

Linear in std::distance(first, last).

Exception Safety

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

Parameters

Name

Description

first

An input iterator pointing to the first element to insert, or pointing to the end of the range.

last

An input iterator pointing to the end of the range.

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.

Template Parameters

Type

Description

InputIt

a type satisfying the requirements of InputIterator.


PrevUpHomeNext