TRIQS/itertools 1.3.0
C++ range library
|
#include <itertools/stride.hpp>
Iterator for a itertools::strided range.
It stores an iterator of the original range as well as a stride. Incrementing advances the original iterator by the given stride. Dereferencing simply returns the dereferenced original iterator.
See itertools::stride(R &&, std::ptrdiff_t) for more details.
Iter | Iterator type. |
Definition at line 46 of file stride.hpp.
Public Member Functions | |
stride_iter ()=default | |
Default constructor. | |
stride_iter (Iter it, std::ptrdiff_t stride) | |
Construct a strided iterator from a given iterator and a given stride. | |
decltype(auto) | dereference () const |
Dereference the iterator. | |
void | increment () |
Increment the iterator by advancing the original iterator by the stride. | |
bool | operator== (stride_iter const &other) const |
Equal-to operator for two itertools::stride_iter objects. | |
Public Attributes | |
Iter | it |
Iterator of the original range. | |
std::ptrdiff_t | stride {1} |
Number of elements in the original range to skip when incrementing the iterator. | |
|
inline |
Construct a strided iterator from a given iterator and a given stride.
it | Iterator of the original range. |
stride | Stride for advancing the iterator (has to be > 0). |
Definition at line 62 of file stride.hpp.
|
inlinenodiscard |
Dereference the iterator.
Definition at line 81 of file stride.hpp.
|
inlinenodiscard |
Equal-to operator for two itertools::stride_iter objects.
other | itertools::stride_iter to compare with. |
Definition at line 75 of file stride.hpp.