[#boost-urls-params_encoded_ref-set-0d]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/params_encoded_ref.adoc[params&lowbar;encoded&lowbar;ref]::set
:relfileprefix: ../../../
:mrdocs:

Set a value

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L889[boost&sol;url&sol;params&lowbar;encoded&lowbar;ref&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/params_encoded_base/iterator.adoc[iterator]
set(
    xref:boost/urls/params_encoded_base/iterator.adoc[iterator] pos,
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] value);
----

== Description

This function replaces the value of an element at the specified position&period;

All iterators that are equal to `pos` or come after are invalidated&period;

[NOTE]
====
The string passed in must not come from the element being replaced, or else the behavior is undefined&period;

====

== Example

[,cpp]
----
url u( "?id=42&id=69" );

u.encoded_params().set( u.encoded_params().begin(), "none" );

assert( u.encoded_query() == "id=none&id=69" );
----
== Complexity

Linear in `this&hyphen;&gt;url()&period;encoded&lowbar;query()&period;size()`&period;

== Exception Safety

Strong guarantee&period; Calls to allocate may throw&period; Exceptions thrown on invalid input&period;

== Exceptions

[cols=2]
|===
| Name
| Thrown on
| `system&lowbar;error`
| `value` contains an invalid percent&hyphen;encoding&period;
|===

== Return Value

An iterator to the element&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *pos*
| An iterator to the element&period;
| *value*
| The value to assign&period; The empty string still counts as a value&period; That is, `has&lowbar;value` for the element is true&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
