Boost.URL Logo

PrevUpHomeNext
segments_encoded::operator= (2 of 2 overloads)

Replace the contents of the container.

Synopsis
segments_encoded&
operator=(
    std::initializer_list< string_view > init);
Description

This function replaces the contents with an initializer list of percent-encoded strings. Each string must contain a valid percent-encoding or else an exception is thrown. The behavior is undefined any string refers to the contents of *this. All iterators and references to elements of the container are invalidated, including the end iterator.

Example
url u = parse_relative_uri( "/path/to/file.txt" );
u.encoded_segments() = { "etc", "init.rc" };
assert( u.encoded_path() == "/etc/init.rc") );
Exception Safety

Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

Parameters

Name

Description

init

An initializer list of strings.

Exceptions

Type

Thrown On

std::invalid_argument

invalid percent-encoding


PrevUpHomeNext