Boost.URL Logo

PrevUpHomeNext
segments::insert (2 of 3 overloads)

Insert a range of segments.

Synopsis
iterator
insert(
    iterator before,
    std::initializer_list< string_view > init);
Description

This function inserts a range of unencoded strings passed as an initializer-list. All references and iterators starting from the newly inserted elements and up to and including the last element and end iterators are invalidated.

Example
url u = parse_relative_uri( "/path/file.txt" );
segments se = u.segments();
se.insert( u.end() - 1, { "to", "the" } );
assert( u.encoded_path() == "/path/to/the/file.txt") );
Exception Safety

Strong guarantee. Calls to allocate may throw.

Remarks

Behavior is undefined if any elements of initializer_list belong to the container

Return Value

An iterator to one past the last newly inserted element or before if the range is empty.

Parameters

Name

Description

before

An iterator before which the new elements should be inserted.

init

The initializer list containing unencoded segments to insert.


PrevUpHomeNext