TRIQS/itertools 1.3.0
C++ range library
|
#include <itertools/enumerate.hpp>
Iterator for an itertools::enumerated range.
It stores an iterator of the original range and an index. Incrementing advances the iterator and the index by 1. Dereferencing returns a std::pair consisting of the current index and the current dereferenced value of the original iterator.
See itertools::enumerate(R &&) for more details.
Iter | Iterator type. |
Definition at line 46 of file enumerate.hpp.
Public Member Functions | |
enum_iter ()=default | |
Default constructor sets the index to zero and default constructs the original iterator. | |
enum_iter (Iter it) | |
Construct an enumerated iterator from a given iterator and set the index to zero. | |
decltype(auto) | dereference () const |
Dereference the iterator. | |
void | increment () |
Increment the iterator by incrementing the original iterator and the index. | |
bool | operator== (enum_iter const &other) const |
Equal-to operator for two itertools::enum_iter objects. | |
template<typename SentinelIter > | |
bool | operator== (sentinel_t< SentinelIter > const &s) const |
Equal-to operator for a itertools::enum_iter and an itertools::sentinel_t. | |
Public Attributes | |
long | i = 0 |
Index for enumerating. | |
Iter | it |
Iterator of the original range. | |
|
inline |
Construct an enumerated iterator from a given iterator and set the index to zero.
it | Iterator of the original range. |
Definition at line 60 of file enumerate.hpp.
|
inlinenodiscard |
Dereference the iterator.
Definition at line 89 of file enumerate.hpp.
|
inlinenodiscard |
Equal-to operator for two itertools::enum_iter objects.
other | itertools::enum_iter to compare with. |
Definition at line 74 of file enumerate.hpp.
|
inlinenodiscard |
Equal-to operator for a itertools::enum_iter and an itertools::sentinel_t.
SentinelIter | Iterator type of the sentinel. |
s | itertools::sentinel_t to compare with. |
Definition at line 83 of file enumerate.hpp.