:relfileprefix: ../../../
[#4B614AD779165837DC3F13A08F16E2DE1D9296DC]

= Function segments_ref::replace

pass:v,q[Replace segments]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/segments_base.adoc[segments_base]::xref:boost/urls/segments_base/iterator.adoc[iterator]
replace(
    xref:boost/urls/segments_base.adoc[segments_base]::xref:boost/urls/segments_base/iterator.adoc[iterator] from,
    xref:boost/urls/segments_base.adoc[segments_base]::xref:boost/urls/segments_base/iterator.adoc[iterator] to,
    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[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.]



== Return Value

* `iterator` 


== Parameters

|===
| Name | Type 

| *from*
| `iterator`

| *to*
| `iterator`

| *s*
| `string_view`

|===



