:relfileprefix: ../../../
[#boost-urls-params_encoded_ref-set]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/params_encoded_ref.adoc[pass:[params_encoded_ref]]::set

  


Set a value



=== Synopsis
  

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/params_encoded_base/iterator.adoc[iterator]
xref:boost/urls/params_encoded_ref/set-0d.adoc[pass:[set]](
    xref:boost/urls/params_encoded_base/iterator.adoc[iterator] pos,
    xref:boost/urls/pct_string_view.adoc[pct_string_view] value);
----

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/params_encoded_base/iterator.adoc[iterator]
xref:boost/urls/params_encoded_ref/set-07.adoc[pass:[set]](
    xref:boost/urls/pct_string_view.adoc[pct_string_view] key,
    xref:boost/urls/pct_string_view.adoc[pct_string_view] value,
    xref:boost/urls/ignore_case_param.adoc[ignore_case_param] ic = = {});
----
  
=== Description


This function replaces the value of an
element at the specified position.



All iterators that are equal to
`pos` or come after are invalidated.
[NOTE]

The string passed in must not come
from the element being replaced,
or else the behavior is undefined.
[,cpp]
----
url u( "?id=42&id=69" );

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

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

=== Linear in `this-&gt;url().encoded_query().size()`.

=== Strong guarantee.

Calls to allocate may throw.
Exceptions thrown on invalid input.


=== Exceptions

|===
| Name | Thrown on

| ``value``
| 
contains an invalid percent-encoding.

| ``key``
| 
or `value` contain an invalid
percent-encoding.

|===

=== Return Value


An iterator to the element.



=== Parameters

|===
| Name | Description 

| *pos*
| 
An iterator to the element.

| *value*
| 
The value to assign. The
empty string still counts as a value.
That is, `has_value` for the element
is true.

| *key*
| 
The key to match.
By default, a case-sensitive
comparison is used.

| *ic*
| 
An optional parameter. If
the value
xref:boost/urls/ignore_case.adoc[ignore_case]
is passed
here, the comparison is
case-insensitive.

|===




