__gnu_para...d_iterator(3)
π
__gnu_para...d_iterator(3) π
okay so this page is straight out of the Library Functions Manual and it's all about __gnu_parallel::guarded_iterator β a little iterator wrapper that keeps a secret boss monster π sitting at the end of your sequence. buckle up bestie, we're going in π¦
β¨ NAME β¨
__gnu_parallel::guarded_iterator β an iterator wrapper that supports an implicit supremum at the end of the sequence, and that supremum dominates all comparisons. no cap, it wins every fight π₯
π SYNOPSIS π
Public Member Functions πΈ
guarded_iterator (RandomAccessIterator begin, RandomAccessIterator end,
Comparator &comp)
operator RandomAccessIterator ()
std::iterator_traits< RandomAccessIterator >::value_type & operator* ()
guarded_iterator< RandomAccessIterator, Comparator > & operator++ ()
Friends π«Ά
bool operator (guarded_iterator< RandomAccessIterator, Comparator >
&bi1, guarded_iterator< RandomAccessIterator, Comparator > &bi2)
bool operator (guarded_iterator< RandomAccessIterator, Comparator >
&bi1, guarded_iterator< RandomAccessIterator, Comparator > &bi2)
(yes, they're both named operator in the docs and yes, there are two of them β that's literally what the manpage says, don't come for me π)
Detailed Description π
template<typename RandomAccessIterator, typename Comparator> class
__gnu_parallel::guarded_iterator< RandomAccessIterator, Comparator >
so the whole vibe: this is an iterator wrapper supporting an implicit supremum at the end of the sequence, dominating all comparisons. it's giving "final boss energy" β β anything past the end just beats everything it's compared against.
β οΈ but bestie, listen β the implicit supremum comes with a performance cost. it's iconic, it's convenient, it is not free π
and here's the reason it isn't just a subclass situation: deriving from RandomAccessIterator is not possible since RandomAccessIterator need not be a class. so no inheritance slay today, we wrap instead π
π Definition at line 84 of file multiway_merge.h.
Constructor & Destructor Documentation π§
guarded_iterator π
template<typename RandomAccessIterator, typename Comparator>
__gnu_parallel::guarded_iterator< RandomAccessIterator, Comparator
>::guarded_iterator (RandomAccessIterator begin, RandomAccessIterator
end, Comparator & comp) [inline]
Constructor! it sets the iterator to the beginning of the sequence. a fresh start, main character energy β¨
Parameters:
beginβ begin iterator of sequence πΈendβ end iterator of sequence πcompβ the comparator provided for the associated overloaded compare operators π¦
π Definition at line 102 of file multiway_merge.h.
Member Function Documentation π
operator RandomAccessIterator () π«
template<typename RandomAccessIterator, typename Comparator>
__gnu_parallel::guarded_iterator< RandomAccessIterator, Comparator
>::operator RandomAccessIterator () [inline]
convert to wrapped iterator. it unwraps the whole thing and hands you back the iterator hiding inside π
Returns: the wrapped iterator.
π Definition at line 124 of file multiway_merge.h.
operator* () β
template<typename RandomAccessIterator, typename Comparator>
std::iterator_traits<RandomAccessIterator>::value_type&
__gnu_parallel::guarded_iterator< RandomAccessIterator, Comparator
>::operator* () [inline]
dereference operator. the classic *it moment β it gives you the thing you're pointing at π
Returns: the referenced element.
π Definition at line 119 of file multiway_merge.h.
operator++ () π₯
template<typename RandomAccessIterator, typename Comparator>
guarded_iterator<RandomAccessIterator, Comparator>&
__gnu_parallel::guarded_iterator< RandomAccessIterator, Comparator
>::operator++ () [inline]
pre-increment operator. moves you forward one step, and notice there's no dummy int argument β that's because it's pre-increment only, iykyk π
Returns: this.
π Definition at line 110 of file multiway_merge.h.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. not a human, just a robot doing its thing π€β¨
so yeah, that's the whole guarded iterator tea β β a wrapper with a built-in supremum, one performance caveat, and a constructor that just wants to be at the beginning. libstdc++, dated 21 Apr 2009, signing off π«Άπ periodt.
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms