__gnu_para...d_iterator(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

πŸ’… __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