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
string::string (7 of 12 overloads)

Constructor.

Synopsis
template<
    class InputIt>
string(
    InputIt first,
    InputIt last,
    storage_ptr sp = {});
Description

Construct the contents with copies of characters in the range {first, last).

Complexity

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

Exception Safety

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

Template Parameters

Type

Description

InputIt

The type of the iterators.

Constraints

InputItsatisfies InputIterator.

Parameters

Name

Description

first

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

last

An input iterator pointing to the end of the range.

sp

An optional pointer to the memory_resource to use. The container will acquire shared ownership of the memory resource. The default argument for this parameter is {}.

Exceptions

Type

Thrown On

std::length_error

std::distance(first, last) > max_size().


PrevUpHomeNext