chsvlib
chsv helper source code
transforming_iterator< BaseIterator, TransformingFunctor > Struct Template Reference

#include <chsvmemex.h>

Public Types

typedef std::remove_reference_t< decltype(std::declval< TransformingFunctor >)(*std::declval< BaseIterator >)))> value_type
 A type of a value yielded by the transforming iterator.
 
typedef value_typereference
 A type of a reference to a value generated by the transforming function object.
 
typedef value_typepointer
 A type of a pointer to a value generated by the transforming function object.
 
typedef BaseIterator iterator_type
 A type of the adapted iterator and an alias of BaseIterator.
 
typedef TransformingFunctor transforming_functor_type
 A type of the transforming functional object. An alias of TransformingFunctor.
 
typedef std::iterator_traits< BaseIterator >::difference_type difference_type
 A type of a signed integral difference between positions of two transforming iterators. It is an alias of the same type associated with the adapted iterator.
 
typedef std::iterator_traits< BaseIterator >::iterator_category iterator_category
 An iterator category specified with respect to the iterator category of the adapted iterator.
 

Public Member Functions

const iterator_typebase () const noexcept
 Returns a read-only reference to the adapted iterator. More...
 
iterator_typebase () noexcept
 Returns a reference to the mutable adapted iterator. More...
 
transforming_functor_typetransformer () noexcept
 Returns a read-only reference to the transforming functional object. More...
 
const transforming_functor_typetransformer () const noexcept
 Returns a reference to the transforming functional object. More...
 
 transforming_iterator ()=default
 Default constructor.
 
 transforming_iterator (const transforming_iterator &right)
 Copy constructor. More...
 
 transforming_iterator (transforming_iterator &&)=default
 Move constructor.
 
template<class TransformingFn >
 transforming_iterator (iterator_type it, TransformingFn &&transformer)
 A constructor initializing the created transforming iterator with a base iterator and a transforming functional object. More...
 
 transforming_iterator (iterator_type it)
 Initializes the created iterator with an adapted iterator and a default-constructed instance of the transforming functional object. More...
 
transforming_iteratoroperator= (const transforming_iterator &right)
 Copy-assignment operator. More...
 
transforming_iteratoroperator= (transforming_iterator &&right)=default
 Move-assignment operator. More...
 
reference operator* () const
 Dereferences the current iterator. More...
 
pointer operator-> () const
 Indirectly dereferences the transforming iterator and provides access to members of the type associated with the result of a transformation. More...
 
transforming_iteratoroperator++ ()
 Advances the position of the transforming iterator by one step towards the end of the iterated sequence. More...
 
unspecified_dereferencable_type operator++ (int)
 Advances the position of the transforming iterator returning a copy of the iterator in the previous state. More...
 
bool operator== (const transforming_iterator &right) const
 Compares two instances of transforming iterators for equality. More...
 
bool operator!= (const transforming_iterator &right) const
 Compares two instances of transforming iterators for inequality. More...
 
transforming_iteratoroperator-- ()
 Advances the position of the transforming iterator towards the beginning of the iterated sequence. More...
 
transforming_iterator operator-- (int)
 Advances the position of the transforming iterator towards the beginning of the iterated sequence and returns a copy of the transforming iterator prior to the decrement. More...
 
transforming_iteratoroperator+= (difference_type n)
 Advances the transforming iterator by a given step from the beginning of the iterated sequence. More...
 
transforming_iterator operator+ (difference_type n) const
 Creates a copy of an iterator associated with a position shifted by a specified number to the end. More...
 
transforming_iteratoroperator-= (difference_type n)
 Advances the transforming iterator by a given step away from the ending of the iterated sequence. More...
 
transforming_iterator operator- (difference_type n) const
 Creates a copy of an iterator associated with a position shifted by a specified number to the beginning of the iterated sequence. More...
 
difference_type operator- (const transforming_iterator &right) const
 Calculates a signed difference between positions of two iterators. More...
 
value_type operator[] (difference_type n) const
 Provides an arbitrary access to the underlying iterated sequence. More...
 
bool operator< (const transforming_iterator &right) const
 Checks if the current position of the left-hand-side iterator is to the left of the position of the parameter, i.e. whether the respective order of the corresponding adopted iterators holds. More...
 
bool operator<= (const transforming_iterator &right) const
 Checks if the current position of the left-hand-side iterator is to the left of the position of the parameter or the two positions match, i.e. whether the respective order of the corresponding adopted iterators holds. More...
 
bool operator> (const transforming_iterator &right) const
 Checks if the current position of the left-hand-side iterator is to the right of the position of the parameter, i.e. whether the respective order of the corresponding adopted iterators holds. More...
 
bool operator>= (const transforming_iterator &right) const
 Checks if the current position of the left-hand-side iterator is to the right of the position of the parameter or the two positions match, i.e. whether the respective order of the corresponding adopted iterators holds. More...
 

Detailed Description

template<class BaseIterator, class TransformingFunctor>
struct Chusov::Memory::transforming_iterator< BaseIterator, TransformingFunctor >

An adapter for iterators to perform a given transformation upon each access to an iterated object.

Template Parameters
BaseIteratoris an iterator to be adapted.
TransformingFunctoris the transforming functor.

Dereferencing the adapter for some iterator it and the functor fn is equivalent to the call fn(*it);.


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