Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
params_ref::set (2 of 2 overloads)

Set a value.

Synopsis
iterator
set(
    string_view key,
    string_view value,
    ignore_case_param ic = {});
Description

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

All iterators are invalidated.

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

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

assert( u.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.

Return Value

An iterator to the appended or modified element.

Parameters

Name

Description

key

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

value

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

ic

An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive.


PrevUpHomeNext