:relfileprefix: ../../../
[#1068E13A463520DAE9CDE4043554506F69F09B1F]

= Function params_ref::set

pass:v,q[Set a value]


== Synopsis

Declared in header `</boost/url/params_ref.hpp#L910[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]
set(
    string_view key,
    string_view value,
    xref:boost/urls/ignore_case_param.adoc[ignore_case_param] ic = = {});
----

== Description

pass:v,q[This function performs one of two] pass:v,q[actions depending on the value of]
pass:v,q[`this->contains( key, ic )`.]

* pass:v,q[If key is contained in the view]
pass:v,q[then one of the matching elements has]
pass:v,q[its value changed to the specified value.]
pass:v,q[The remaining elements with a matching]
pass:v,q[key are erased. Otherwise,]

* pass:v,q[If `key` is not contained in the]
pass:v,q[view, then the function apppends the]
pass:v,q[param `{ key, value }`.]
pass:v,q[All iterators are invalidated.]

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

u.params().set( "id", "none" );

assert( u.params().count( "id" ) == 1 );
----

=== Postconditions
[,cpp]
----
this->count( key, ic ) == 1 && this->find( key, ic )->value == value
----

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

| *key*
| `string_view`

| *value*
| `string_view`

| *ic*
| `ignore_case_param`

|===



