template<typename T>
py::Range struct

Range.

Template parameters
T

The code snippet defines a struct template called Range that represents a range of values. It has two template parameters, T which represents the type of the values in the range.

Public types

using iterator = RangeIterator<T>
using value_type = T
using key_type = T

Public functions

auto begin() const -> iterator -> auto constexpr
begin
auto end() const -> iterator -> auto constexpr
end
auto empty() const -> bool -> auto constexpr
empty
auto size() const -> size_t -> auto constexpr
size
auto operator[](size_t n) const -> T -> auto constexpr
auto contains(T n) const -> bool -> auto constexpr

Public variables

T start
T stop

Function documentation

template<typename T>
auto py::Range<T>::begin() const -> iterator constexpr

begin

Returns iterator

The begin() function is a member function of the Range struct template. It returns an iterator pointing to the beginning of the range. In this case, it creates a RangeIterator object with the start value of the range and returns it.

template<typename T>
auto py::Range<T>::end() const -> iterator constexpr

end

Returns iterator

The end() function is a member function of the Range struct template. It returns an iterator pointing to the end of the range. In this case, it creates a RangeIterator object with the stop value of the range and returns it. This iterator represents the position one past the last element in the range.

template<typename T>
auto py::Range<T>::empty() const -> bool constexpr

empty

Returns true

The empty() function is a member function of the Range struct template. It checks if the range is empty, meaning if the start and stop values are equal.

template<typename T>
auto py::Range<T>::size() const -> size_t constexpr

size

Returns size_t

The size() function is a member function of the Range struct template. It calculates and returns the size of the range, which is the number of elements in the range.

template<typename T>
auto py::Range<T>::operator[](size_t n) const -> T constexpr

Parameters
in
Returns T

template<typename T>
auto py::Range<T>::contains(T n) const -> bool constexpr

Parameters
in
Returns true