swift
Public Member Functions | List of all members
swift::misc::Iterators::ConditionalIterator< I, F > Class Template Reference

Iterator wrapper which skips over any elements which do not satisfy a given condition predicate. More...

Public Types

using iterator_category = std::forward_iterator_tag
 Types.
 
using value_type = typename std::iterator_traits< I >::value_type
 Types.
 
using difference_type = typename std::iterator_traits< I >::difference_type
 Types.
 
using pointer = typename std::iterator_traits< I >::pointer
 Types.
 
using reference = typename std::iterator_traits< I >::reference
 Types.
 

Public Member Functions

 ConditionalIterator (I iterator, I end, F predicate)
 Constructor.
 
 ConditionalIterator (I end)
 Implicit conversion from an end iterator.
 
operator-> ()
 Indirection operator, returns the underlying iterator. Undefined if iterator is at the end.
 
std::iterator_traits< I >::reference operator* ()
 Dereference operator, returns the object referenced by the iterator. Undefined if iterator is at the end.
 
ConditionalIteratoroperator++ ()
 Advance the iterator to the next element which matches the predicate, or the end if there are none remaining. Undefined if the iterator is already at the end.
 
ConditionalIterator operator++ (int)
 Advance the iterator to the next element which matches the predicate, or the end if there are none remaining. Undefined if the iterator is already at the end.
 
bool operator== (const ConditionalIterator &other) const
 Comparison operators.
 
bool operator!= (const ConditionalIterator &other) const
 Comparison operators.
 
bool operator< (const ConditionalIterator &other) const
 Comparison operators.
 
bool operator<= (const ConditionalIterator &other) const
 Comparison operators.
 
bool operator> (const ConditionalIterator &other) const
 Comparison operators.
 
bool operator>= (const ConditionalIterator &other) const
 Comparison operators.
 

Detailed Description

template<class I, class F>
class swift::misc::Iterators::ConditionalIterator< I, F >

Iterator wrapper which skips over any elements which do not satisfy a given condition predicate.

By creating a CRange from such iterators, it is possible to return the results of predicate methods without copying elements.

Definition at line 202 of file iterator.h.


The documentation for this class was generated from the following file: