[#boost-urls-segments_encoded_ref-replace-02]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/segments_encoded_ref.adoc[segments&lowbar;encoded&lowbar;ref]::replace
:relfileprefix: ../../../
:mrdocs:

Replace segments

== Synopses

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L594[boost&sol;url&sol;segments&lowbar;encoded&lowbar;ref&period;hpp]&gt;`

Replace segments


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/segments_encoded_base/iterator.adoc[iterator]
xref:boost/urls/segments_encoded_ref/replace-07.adoc[replace](
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] pos,
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] s);
----

[.small]#xref:boost/urls/segments_encoded_ref/replace-07.adoc[_» more&period;&period;&period;_]#

Replace segments


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/segments_encoded_base/iterator.adoc[iterator]
xref:boost/urls/segments_encoded_ref/replace-06.adoc[replace](
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] from,
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] to,
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] s);
----

[.small]#xref:boost/urls/segments_encoded_ref/replace-06.adoc[_» more&period;&period;&period;_]#

Replace segments


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/segments_encoded_base/iterator.adoc[iterator]
xref:boost/urls/segments_encoded_ref/replace-08.adoc[replace](
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] from,
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] to,
    std::initializer&lowbar;list&lt;xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view]&gt; init);
----

[.small]#xref:boost/urls/segments_encoded_ref/replace-08.adoc[_» more&period;&period;&period;_]#

Replace segments


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FwdIt&gt;
xref:boost/urls/segments_encoded_base/iterator.adoc[iterator]
xref:boost/urls/segments_encoded_ref/replace-0f.adoc[replace](
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] from,
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] to,
    FwdIt first,
    FwdIt last);
----

[.small]#xref:boost/urls/segments_encoded_ref/replace-0f.adoc[_» more&period;&period;&period;_]#

== Exceptions

[cols=2]
|===
| Name
| Thrown on
| `system&lowbar;error`
| The string contains an invalid percent&hyphen;encoding&period;
|===

== Return Value

* An iterator to the replaced segment&period;
* An iterator to the new segment&period;
* An iterator to the first segment inserted, or one past `to` if `init&period;size() &equals;&equals; 0`&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *pos*
| An iterator to the segment&period;
| *s*
| The string to assign&period;
| *from*
| The first element in the range of segments to replace&period;
| *to*
| One past the last element in the range of segments to replace&period;
| *init*
| The list of segments to assign&period;
| *first*
| The first element in the new range of segments&period;
| *last*
| One past the last element in the new range of segments&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
