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 a snapshot of the master branch, built from commit 69109f5924.
PrevUpHomeNext
array::if_contains (1 of 2 overloads)

Return a pointer to an element, or nullptr if the index is invalid.

Synopsis
value const*
if_contains(
    std::size_t pos) const;
Description

This function returns a pointer to the element at index pos when the index is less then the size of the container. Otherwise it returns null.

Example
if ( auto p = arr.if_contains( 1 ) )
    std::cout << *p;
Complexity

Constant.

Exception Safety

No-throw guarantee.

Parameters

Name

Description

pos

The index of the element to return.


PrevUpHomeNext