Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
object::if_contains (2 of 2 overloads)

Return a pointer to the value if the key is found, or null.

Synopsis
value*
if_contains(
    string_view key);
Description

This function searches for a value with the given key, and returns a pointer to it if found. Otherwise it returns null.

Example
if( auto p = obj.if_contains( "key" ) )
    std::cout << *p;
Complexity

Constant on average, worst case linear in size().

Exception Safety

No-throw guarantee.

Parameters

Name

Description

key

The key of the element to find.

See Also

find


PrevUpHomeNext