A functor class that returns the last value in an iterator range. More...
#include <optional_last_value.hpp>
Public Types | |
using | Result_type = std::optional< T > |
Type of object the iterator range points to. | |
Public Member Functions | |
template<typename InputIterator > | |
auto | operator() (InputIterator first, InputIterator last) const -> Result_type |
A functor class that returns the last value in an iterator range.
Attempts to dereference every iterator in the range [first, last). If the iterator range is empty, an empty opt::Optional object is returned, otherwise an opt::Optional wrapping the last value is returned.
|
inline |
first | Input iterator to the first element in the range. |
last | Input iterator to one past the last element in the range. |