Set a value

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L951[boost/url/params_encoded_ref.hpp,window=blank_]>

Description

This function performs one of two actions depending on the value of this->contains( key, ic ).

  • If key is contained in the view then one of the matching params has its value changed to the specified value. The remaining params with a matching key are erased. Otherwise,

  • If key is not contained in the view, then the function apppends the param { key, value }. All iterators are invalidated.

    Note
    The strings passed in must not come from the element being replaced, or else the behavior is undefined.

Example

url u( "?id=42&id=69" );

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

assert( u.encoded_params().count( "id" ) == 1 );

Postconditions

this->count( key, ic ) == 1 && this->find( key, ic )->value == value

Complexity

Linear in this->url().encoded_query().size().

Exception Safety

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

Return Value

  • iterator

Parameters

Name Type

key

pct_string_view

value

pct_string_view

ic

ignore_case_param