:relfileprefix: ../../../
[#DCE9E0DE35F592C70096C7DC5A6E4B5D6E858A57]

= Function params_ref::replace

pass:v,q[Replace elements]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/params_base.adoc[params_base]::xref:boost/urls/params_base/iterator.adoc[iterator]
replace(
    xref:boost/urls/params_base.adoc[params_base]::xref:boost/urls/params_base/iterator.adoc[iterator] pos,
    const xref:boost/urls/param_view.adoc[param_view]& p);
----

== Description

pass:v,q[This function replaces the contents] pass:v,q[of the element at `pos` with the]
pass:v,q[specified param.]
pass:v,q[All iterators that are equal to]
pass:v,q[`pos` or come after are invalidated.]

=== Example
[,cpp]
----
url u( "?first=John&last=Doe" );

u.params().replace( u.params().begin(), { "title", "Mr" });

assert( u.encoded_query() == "title=Mr&last=Doe" );
----

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

=== Exception Safety
pass:v,q[Strong guarantee.]
pass:v,q[Calls to allocate may throw.]



== Return Value

* `iterator` 


== Parameters

|===
| Name | Type 

| *pos*
| `iterator`

| *p*
| ``

|===



