template<typename T>
py::detail::EnumerateIterator struct

EnumerateIterator.

The code defines a struct called EnumerateIterator that is used to iterate over a container or range and provide the index of each element in the iteration.

Public types

using TIter = decltype(std::begin(std::declval<T>()))
using iter_ref = typename std::iterator_traits<TIter>::reference

Public functions

auto operator!=(const EnumerateIterator& other) const -> bool -> auto
Not equal to.
auto operator++() -> EnumerateIterator&
The operator++() function is an overloaded operator that increments the EnumerateIterator object. It increases the value of the i member variable by 1 and advances the iter member variable to the next element in the iteration. It then returns a reference to the updated EnumerateIterator object.
auto operator*() -> std::pair< size_t, iter_ref > -> auto
The operator*() function is an overloaded operator that returns the current element in the iteration as a std::pair<size_t, iter_ref>. The size_t value represents the index of the element, and the iter_ref value represents a reference to the element itself. This allows you to access both the index and the element in a single expression when using the enumerate() function.

Public variables

size_t i
TIter iter

Function documentation

template<typename T _1>
auto py::detail::EnumerateIterator<_1>::operator!=(const EnumerateIterator& other) const -> bool

Not equal to.

Parameters
other in
Returns true

The operator!= function is an overloaded operator that checks for inequality between two EnumerateIterator objects. It compares the iter member of the current object with the iter member of the other object. If they are not equal, it returns true, indicating that the two iterators are not pointing to the same element. Otherwise, it returns false, indicating that the two iterators are equal.

template<typename T _1>
EnumerateIterator& py::detail::EnumerateIterator<_1>::operator++()

The operator++() function is an overloaded operator that increments the EnumerateIterator object. It increases the value of the i member variable by 1 and advances the iter member variable to the next element in the iteration. It then returns a reference to the updated EnumerateIterator object.

Returns EnumerateIterator&

template<typename T _1>
auto py::detail::EnumerateIterator<_1>::operator*() -> std::pair< size_t, iter_ref >

The operator*() function is an overloaded operator that returns the current element in the iteration as a std::pair<size_t, iter_ref>. The size_t value represents the index of the element, and the iter_ref value represents a reference to the element itself. This allows you to access both the index and the element in a single expression when using the enumerate() function.

Returns std::pair<size_t, iter_ref>