Insert a range of segments.
template< class FwdIt> iterator insert( iterator before, FwdIt first, FwdIt last);
This function inserts a range of percent-encoded strings. Each string
must contain a valid percent-encoding or else an exception is thrown.
The behavior is undefined if either argument is an iterator into this
. All references and iterators starting
from the newly inserted elements and up to and including the last element
and end
iterators are invalidated.
std::is_convertible< std::iterator_traits< FwdIt >::value_type, string_view >::value == true
url u = parse_relative_uri( "/path/file.txt" ); segments_encoded se = u.encoded_segments(); std::vector< std::string > v = { "to", "the" }; se.insert( u.end() - 1, v.begin(), v.end() ); assert( u.encoded_path() == "/path/to/the/file.txt") );
Behavior is undefined if any elements of the range belong to the container
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
An iterator to one past the last newly inserted element or before
if the range is empty.
Name |
Description |
---|---|
|
An iterator before which the new element should be inserted. |
|
An iterator to the first element to insert. |
|
An iterator to one past the last element to insert. |
Type |
Thrown On |
---|---|
|
invalid percent-encoding |