...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Return a pointer to an element, or nullptr if the index is invalid.
value* if_contains( std::size_t pos);
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.
if( auto p = arr.if_contains( 1 ) ) std::cout << *p;
Constant.
No-throw guarantee.
Name |
Description |
---|---|
|
The index of the element to return. |