-
-
Save picanumber/a9bf71975d6d4098b2c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class iterator | |
{ // Publicly define the standard typedefs | |
reference _state; | |
std::size_t _pos; | |
std::tuple<Ts...>& _nodes; | |
public: | |
iterator(reference state, std::size_t pos, | |
std::tuple<Ts...>& nodes) | |
: _state(state), _pos(pos), _nodes(nodes) | |
{} | |
iterator(const iterator& other) | |
: _state(other._state) | |
, _pos(other._pos) | |
, _nodes(other._nodes) | |
{} | |
iterator& operator=(const iterator& other) { | |
_state = other._state; | |
_pos = other._pos; | |
_nodes = other._nodes; | |
return *this; | |
} | |
bool operator==(const iterator& other) const { return _pos == other._pos; } | |
bool operator<(const iterator& other) const { return _pos < other._pos; } | |
iterator& operator++() { | |
++_pos; | |
_state = vtu::call_with_tuple_element_first(F{}, _nodes, | |
_pos, _state); | |
return *this; | |
} | |
reference operator*() const { return _state; } | |
pointer operator->() const { return &_state; } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment