CXXIter 0.2
Loading...
Searching...
No Matches
CXXIter::trait::Iterator< T > Struct Template Reference

Trait, that is used for the chaining and the operation of iterator pipelines. More...

#include <Traits.h>

Collaboration diagram for CXXIter::trait::Iterator< T >:

Public Types

using Self = trait::Iterator< T >
 Self-Type. This is the type of the struct for which the trait::Iterator is being specialized. More...
 
using Item = void
 Item-Type. This is the type of elements that can be pulled from this pipeline-element. More...
 

Static Public Member Functions

static constexpr IterValue< Itemnext (Self &self)=delete
 Pull one element from the iterator pipeline previous to this pipeline-element. More...
 
static constexpr SizeHint sizeHint (const Self &self)=delete
 Get the bounds on the remaining length of the iterator pipeline until this pipeline-element, estimated from the source and all of the chained iterations until after this pipeline-element. More...
 
static constexpr size_t advanceBy (Self &self, size_t n)=delete
 Advance the iterator by n elements. More...
 

Detailed Description

template<typename T>
struct CXXIter::trait::Iterator< T >

Trait, that is used for the chaining and the operation of iterator pipelines.

This allows making any class or struct iterable, to be able to interact with CXXIter's iterator pipelines. It essentially provides two functions:

  • One that delivers a hint about the iterator's size after the current element implementing the trait CXXIter::trait::Iterator
  • Method that allows pulling one element from the iterator pipeline.

Definition at line 24 of file Traits.h.

Member Typedef Documentation

◆ Item

template<typename T >
using CXXIter::trait::Iterator< T >::Item = void

Item-Type. This is the type of elements that can be pulled from this pipeline-element.

Definition at line 32 of file Traits.h.

◆ Self

template<typename T >
using CXXIter::trait::Iterator< T >::Self = trait::Iterator<T>

Self-Type. This is the type of the struct for which the trait::Iterator is being specialized.

Definition at line 28 of file Traits.h.

Member Function Documentation

◆ advanceBy()

template<typename T >
static constexpr size_t CXXIter::trait::Iterator< T >::advanceBy ( Self self,
size_t  n 
)
inlinestaticconstexprdelete

Advance the iterator by n elements.

If possible, this should be forwarded to the previous pipeline element, because then the pipeline source has the possibility to implement this as a O(1) operation, if supported.

Parameters
nThe amount of elements to advance the iterator by.
Returns
The amount of elements by which the iterator was actually advanced (e.g. if the iterator did have less than n elements remaining)

◆ next()

template<typename T >
static constexpr IterValue< Item > CXXIter::trait::Iterator< T >::next ( Self self)
inlinestaticconstexprdelete

Pull one element from the iterator pipeline previous to this pipeline-element.

Parameters
selfReference to the instance of the class for which trait::Iterator is being specialized.
Returns
An element (if any) wrapped in the CXXIter::IterValue.

◆ sizeHint()

template<typename T >
static constexpr SizeHint CXXIter::trait::Iterator< T >::sizeHint ( const Self self)
inlinestaticconstexprdelete

Get the bounds on the remaining length of the iterator pipeline until this pipeline-element, estimated from the source and all of the chained iterations until after this pipeline-element.

Returns
The estimated bounds on the remaining length of the iterator pipeline until after this pipeline-element.

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