[#boost-urls-params_encoded_ref-set]
= 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#L879[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]
xref:boost/urls/params_encoded_ref/set-0d.adoc[set](
    xref:boost/urls/params_encoded_base/iterator.adoc[iterator] pos,
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] value);
----

[.small]#xref:boost/urls/params_encoded_ref/set-0d.adoc[_» more..._]#

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/params_encoded_base/iterator.adoc[iterator]
xref:boost/urls/params_encoded_ref/set-07.adoc[set](
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] key,
    xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] value,
    xref:boost/urls/ignore_case_param.adoc[ignore&lowbar;case&lowbar;param] ic = &lcub;&rcub;);
----

[.small]#xref:boost/urls/params_encoded_ref/set-07.adoc[_» more..._]#

== 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


|===
| Name | Thrown on

| `system&lowbar;error`
| `value` contains an invalid percent&hyphen;encoding&period;


|===

== Return Value


An iterator to the element&period;



== Parameters


|===
| 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;


| *key*
| The key to match&period;        By default, a case&hyphen;sensitive        comparison is used&period;


| *ic*
| An optional parameter&period; If        the value xref:boost/urls/ignore_case.adoc[ignore&lowbar;case] is passed        here, the comparison is        case&hyphen;insensitive&period;


|===



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