:relfileprefix: ../../../
[#60E49D1AF8450F67CAD1478F9BC0E0BD33C197DD]

= Function segments_encoded_ref::replace

pass:v,q[Replace segments]


== Synopsis

Declared in header `</boost/url/segments_encoded_ref.hpp#L626[boost/url/segments_encoded_ref.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/segments_encoded_base.adoc[segments_encoded_base]::xref:boost/urls/segments_encoded_base/iterator.adoc[iterator]
replace(
    xref:boost/urls/segments_encoded_base.adoc[segments_encoded_base]::xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] from,
    xref:boost/urls/segments_encoded_base.adoc[segments_encoded_base]::xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] to,
    xref:boost/urls/pct_string_view.adoc[pct_string_view] s);
----

== Description

pass:v,q[This function replaces a range of] pass:v,q[segments with one segment.]
pass:v,q[Reserved characters in the string are]
pass:v,q[automatically escaped.]
pass:v,q[Escapes in the string are preserved.]
pass:v,q[All iterators that are equal to]
pass:v,q[`from` or come after are invalidated.]

=== Complexity
pass:v,q[Linear in `s.size() + this->url().encoded_resouce().size()`.]

=== Exception Safety
pass:v,q[Strong guarantee.]
pass:v,q[Calls to allocate may throw.]
pass:v,q[Exceptions thrown on invalid input.]



== Return Value

* `iterator` 


== Parameters

|===
| Name | Type 

| *from*
| `iterator`

| *to*
| `iterator`

| *s*
| `pct_string_view`

|===



