PLaSK library
Loading...
Searching...
No Matches
plask::PolymorphicForwardIteratorWithIndexImpl< ValueT, ReferenceT > Struct Template Referenceabstract

Base class for forward, polymorphic iterators implementations which allow to get index of current position. More...

#include <plask/utils/iterators.hpp>

Inheritance diagram for plask::PolymorphicForwardIteratorWithIndexImpl< ValueT, ReferenceT >:
[legend]
Collaboration diagram for plask::PolymorphicForwardIteratorWithIndexImpl< ValueT, ReferenceT >:
[legend]

Public Member Functions

virtual std::size_t getIndex () const =0
 Get index for current iterator state.
 
- Public Member Functions inherited from plask::PolymorphicForwardIteratorImpl< ValueT, ReferenceT >
virtual ReferenceT dereference () const =0
 
virtual void increment ()=0
 Iterate to next value.
 
virtual ~PolymorphicForwardIteratorImpl ()
 Virtual destructor, do nothing.
 
virtual bool equal (const PolymorphicForwardIteratorImpl &other) const =0
 Check if this is equal to other.
 
virtual std::unique_ptr< PolymorphicForwardIteratorImpl< ValueT, ReferenceT > > clone () const =0
 Clone this iterator.
 

Additional Inherited Members

- Public Types inherited from plask::PolymorphicForwardIteratorImpl< ValueT, ReferenceT >
typedef ValueT value_type
 Type of objects pointed by the iterator.
 
typedef ReferenceT reference
 Type to represent a reference to an object pointed by the iterator.
 

Detailed Description

template<typename ValueT, typename ReferenceT = ValueT&>
struct plask::PolymorphicForwardIteratorWithIndexImpl< ValueT, ReferenceT >

Base class for forward, polymorphic iterators implementations which allow to get index of current position.

It is similar to PolymorphicForwardIteratorImpl but has getIndex method.

Template Parameters
ValueTType to iterate over.
ReferenceTType returned by dereference operation. Note that default type is not good if dereference returns temporary object. In such case const ValueT can be a better choice.

Definition at line 87 of file iterators.hpp.

Member Function Documentation

◆ getIndex()

template<typename ValueT , typename ReferenceT = ValueT&>
virtual std::size_t plask::PolymorphicForwardIteratorWithIndexImpl< ValueT, ReferenceT >::getIndex ( ) const
pure virtual

Get index for current iterator state.

Returns
index for current iterator state

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