std::default_sentinel_t(3cxx)

πŸ“¦
version 15.2.0 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– std::default_sentinel_t πŸ’–

okay so bestie, we're looking at std::default_sentinel_t(3cxx) and it's lowkey iconic for such a tiny little sentinel. not me getting emotional over an iterator helper πŸ˜­πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <iterator>

πŸ’… DETAILED DESCRIPTION πŸ’…

A sentinel type that can be used to check for the end of a range. periodt. ✨

For some iterator types, the past-the-end sentinel value is independent of the underlying sequence, and a default sentinel can be used with them. it's giving "we don't need the whole sequence to know we're done" energy 🫢

For example, a std::counted_iterator keeps a count of how many elements remain, and so checking for the past-the-end value only requires checking if that count has reached zero. literally just "count == 0" and you're out, slay πŸ’€βœ¨

A past-the-end std::istream_iterator is equal to the default-constructed value, which can be easily checked. easy peasy, no cap πŸ“

Comparing iterators of these types to std::default_sentinel is a convenient way to check if the end has been reached. it's the main character move for "are we there yet?" vibes πŸ‘‘


⏰ SINCE ⏰

  • Since: C++20 🌈

πŸŽ€ AUTHOR πŸŽ€

Generated automatically by Doxygen for libstdc++ from the source code. πŸ€–πŸ’–


mwah πŸ’– huge kisses to libstdc++ β€” that's the source/version flex in the footer β€” and if you were hunting for a date on this page, bestie, it's simply not giving one πŸ§šβ€β™€οΈβœ¨