Element Access¶
element_at¶
Gets the element of the range at position index (zero-based).
| Example | |
|---|---|
first¶
- Gets the first element of the range. If the range is empty, an empty optional is produced.
- Gets the first element of the range that satisfies a
predicate. If the range is empty, or no element satisfied the predicate, an empty optional is produced.
Signature
// 1.
constexpr auto first() const -> std::optional<output_t>;
// 2.
template <typename TPredicate>
constexpr auto first( const TPredicate& predicate ) const -> std::optional<output_t>;
last¶
- Gets the last element of the range. If the range is empty, an empty optional is produced.
- Gets the last element of the range that satisfies a
predicate. If the range is empty, or no element satisfied the predicate, an empty optional is produced.
Signature
// 1.
constexpr auto last() const -> std::optional<output_t>;
// 2.
template <typename TPredicate>
constexpr auto last( const TPredicate& predicate ) const -> std::optional<output_t>;