:relfileprefix: ../../../
[#F8C5B33373753612BB95F027EA2EE4968EBD6FB3]

= Function segments_encoded_ref::replace

pass:v,q[Replace segments]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class FwdIt>
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,
    FwdIt first,
    FwdIt last);
----

== Description

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

=== Preconditions
pass:v,q[None of the character buffers referenced]
pass:v,q[by the new range may overlap the character]
pass:v,q[buffer of the underlying url, or else]
pass:v,q[the behavior is undefined.]

=== Complexity
pass:v,q[Linear in `std::distance( first, last ) + 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`

| *first*
| `FwdIt`

| *last*
| `FwdIt`

|===



