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

Iterator wrapper which applies some transformation function to each element. More...

Public Types

using undecayed_type = decltype(std::declval< F >()(std::declval< typename std::iterator_traits< I >::value_type >()))
 The type returned by the transformation function, which may or may not be a reference.
 
using pointer = typename std::conditional< std::is_reference_v< undecayed_type >, std::remove_reference_t< undecayed_type > *, PointerWrapper >::type
 The type returned by this iterator's arrow operator, which may be a pointer or a pointer-like wrapper object.
 
using iterator_category = std::forward_iterator_tag
 Types.
 
using value_type = std::decay_t< decltype(std::declval< F >()(std::declval< typename std::iterator_traits< I >::value_type >()))>
 Types.
 
using difference_type = typename std::iterator_traits< I >::difference_type
 Types.
 
using reference = typename std::iterator_traits< I >::reference
 Types.
 

Public Member Functions

 TransformIterator (I iterator, F function)
 Constructor.
 
 TransformIterator (I end)
 Implicit conversion from an end iterator.
 
undecayed_type operator* ()
 Dereference operator, returns the transformed object reference by the iterator. Undefined if iterator is at the end.
 
pointer operator-> ()
 Indirection operator, returns a pointer to the transformed object, or a pointer-like wrapper object if the transformation function returns by value. Undefined if iterator is at the end.
 
TransformIteratoroperator++ ()
 Advance to the next element. Undefined if iterator is at the end.
 
TransformIterator operator++ (int)
 Advance to the next element. Undefined if iterator is at the end.
 
bool operator== (const TransformIterator &other) const
 Comparison operators.
 
bool operator!= (const TransformIterator &other) const
 Comparison operators.
 
bool operator< (const TransformIterator &other) const
 Comparison operators.
 
bool operator<= (const TransformIterator &other) const
 Comparison operators.
 
bool operator> (const TransformIterator &other) const
 Comparison operators.
 
bool operator>= (const TransformIterator &other) const
 Comparison operators.
 

Detailed Description

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

Iterator wrapper which applies some transformation function to each element.

By creating a CRange from such iterators, it is possible to perform a transformation on a container without copying elements.

Definition at line 107 of file iterator.h.


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