[#boost-urls-params_ref-set-09]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/params_ref.adoc[params&lowbar;ref]::set
:relfileprefix: ../../../
:mrdocs:

Set a value

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/params_base/iterator.adoc[iterator]
set(
    xref:boost/urls/params_base/iterator.adoc[iterator] pos,
    core::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;

== Example

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

u.params().set( u.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;

== Return Value

An iterator to the element&period;

== Parameters

[cols="1,4"]
|===
|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]#
