Template Struct enumerate_range

Nested Relationships

Nested Types

Struct Documentation

template<class Container>
struct util::enumerate_range

A helper class for Python-like enumerating through the elements of a container.

tparam Container

the type of container used in this range

Public Types

using container_reference = Container&

Public Functions

explicit enumerate_range(container_reference container)
auto begin() -> iterator
auto end() -> iterator

Public Static Attributes

static constexpr bool Const = std::is_const_v<Container>
class iterator

Public Types

using size_type = typename Container::size_type
using value_type = typename Container::value_type
using pointer = typename std::conditional_t<Const, const value_type*, value_type*>
using reference = typename std::conditional_t<Const, const value_type&, value_type&>
using container_iterator = typename std::conditional_t<Const, typename Container::const_iterator, typename Container::iterator>

Public Functions

iterator(container_iterator iterator)
auto operator!=(const iterator &other) -> bool
auto operator++() -> iterator&
auto operator*() const -> pair
struct pair

Public Members

size_type pos
reference ref