:relfileprefix: ../../../
[#7121FC52947A25DACD68DD64B2F36B2E7FC7566D]

= Function segments_encoded_ref::replace

pass:v,q[Replace segments]


== Synopsis

Declared in header `</boost/url/segments_encoded_ref.hpp#L591[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] pos,
    xref:boost/urls/pct_string_view.adoc[pct_string_view] s);
----

== Description

pass:v,q[This function replaces the segment at] pass:v,q[the specified position.]
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[`pos` 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 

| *pos*
| `iterator`

| *s*
| `pct_string_view`

|===



