#include <py2cpp/range.hpp>
template<typename T>
Range struct
| 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
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>:: operator[](size_t n) const -> T constexpr
| Parameters | |
|---|---|
| n in | |
| Returns | T |
template<typename T>
auto py:: Range<T>:: contains(T n) const -> bool constexpr
| Parameters | |
|---|---|
| n in | |
| Returns | true |