:relfileprefix: ../../../ [#boost-urls-segments_encoded_ref-insert] == xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/segments_encoded_ref.adoc[pass:[segments_encoded_ref]]::insert Insert segments === Synopsis [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] xref:boost/urls/segments_encoded_ref/insert-04.adoc[pass:[insert]]( xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] before, xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] xref:boost/urls/segments_encoded_ref/insert-0d.adoc[pass:[insert]]( xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] before, std::initializer_list init); ---- [source,cpp,subs="verbatim,macros,-callouts"] ---- template xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] xref:boost/urls/segments_encoded_ref/insert-07.adoc[pass:[insert]]( xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] before, FwdIt first, FwdIt last); ---- === Description This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. Escapes in the segment are preserved. All iterators that are equal to `before` or come after are invalidated. === Linear in `s.size() + this->url().encoded_resource().size()`. === Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === Exceptions |=== | Name | Thrown on | `The` | segment contains an invalid percent-encoding. |=== === Return Value An iterator to the inserted segment. === Parameters |=== | Name | Description | *before* | An iterator before which the segment is inserted. This may be equal to `end()`. | *s* | The segment to insert. | *init* | The list of segments to insert. | *first,* | last The range of segments to insert. |===