Py2Cpp 1.6.3; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
py::Range< T > Struct Template Reference

Python-like range implementation. More...

#include <range.hpp>

Public Types

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

Public Member Functions

constexpr auto begin () const -> iterator
 Get iterator to the beginning of the range.
 
constexpr auto end () const -> iterator
 Get iterator to the end of the range.
 
constexpr auto empty () const -> bool
 Check if the range is empty.
 
constexpr auto size () const -> size_t
 Get the size of the range.
 
constexpr auto operator[] (size_t n) const -> T
 Get element at index.
 
constexpr auto contains (T n) const noexcept -> bool
 Check if the range contains a value.
 

Public Attributes

start
 
stop
 

Detailed Description

template<typename T>
struct py::Range< T >

Python-like range implementation.

Represents a sequence of numbers from start to stop (exclusive), similar to Python's range() function.

Template Parameters
TThe numeric type for the range values

Member Typedef Documentation

◆ iterator

template<typename T >
using py::Range< T >::iterator = RangeIterator<T>

◆ key_type

template<typename T >
using py::Range< T >::key_type = T

◆ value_type

template<typename T >
using py::Range< T >::value_type = T

Member Function Documentation

◆ begin()

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

Get iterator to the beginning of the range.

Returns an iterator pointing to the start value of the range.

Returns
iterator Iterator to the beginning

◆ contains()

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

Check if the range contains a value.

Parameters
[in]nThe value to check
Returns
true if the range contains the value, false otherwise

◆ empty()

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

Check if the range is empty.

Returns true if the range has no elements (start equals stop).

Returns
true if the range is empty, false otherwise

◆ end()

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

Get iterator to the end of the range.

Returns an iterator pointing past the last element in the range.

Returns
iterator Iterator past the last element

◆ operator[]()

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

Get element at index.

Returns the value at the specified index in the range.

Parameters
[in]nThe index
Returns
T The value at the index

◆ size()

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

Get the size of the range.

Returns the number of elements in the range.

Returns
size_t Number of elements in the range

Member Data Documentation

◆ start

template<typename T >
T py::Range< T >::start

◆ stop

template<typename T >
T py::Range< T >::stop

The documentation for this struct was generated from the following file: