ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
meta::util::basic_range< T > Class Template Reference

Implements a range that spans a loop's extension and termination conditions, most useful for iterating over a range of numbers with a range-based for loop. More...

#include <range.h>

Classes

class  iterator_t
 Iterator to traverse the generic range. More...
 

Public Types

using iterator = iterator_t< std::plus< T >>
 the iterator for the range class
 
using const_iterator = iterator
 the const_iterator for the range class (same as the iterator)
 
using reverse_iterator = iterator_t< std::minus< T >>
 the reverse_iterator for the range class
 
using const_reverse_iterator = reverse_iterator
 the const_reverse_iterator for the range class
 

Public Member Functions

iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
 basic_range (const T &begin, const T &end, const T &step)
 Constructs a range. More...
 
 basic_range (const basic_range &)=default
 
 basic_range (basic_range &&)=default
 
basic_rangeoperator= (const basic_range &)=default
 
basic_rangeoperator= (basic_range &&)=default
 
 ~basic_range ()=default
 Defaulted destructor.
 

Public Attributes

friend iterator
 
friend reverse_iterator
 

Private Attributes

_begin
 the beginning value for the range
 
_end
 the ending value for the range
 
size_t _num
 the number of values contained in the range
 
_step
 the step size of the range
 

Detailed Description

template<class T>
class meta::util::basic_range< T >

Implements a range that spans a loop's extension and termination conditions, most useful for iterating over a range of numbers with a range-based for loop.

Constructor & Destructor Documentation

template<class T>
meta::util::basic_range< T >::basic_range ( const T &  begin,
const T &  end,
const T &  step 
)
inline

Constructs a range.

Parameters
beginThe starting value for the range
endThe ending value for the range
stepThe step size of the range

Member Function Documentation

template<class T>
iterator meta::util::basic_range< T >::begin ( ) const
inline
Returns
an iterator the beginning of the range
template<class T>
iterator meta::util::basic_range< T >::end ( ) const
inline
Returns
an iterator to the end of the range
template<class T>
reverse_iterator meta::util::basic_range< T >::rbegin ( ) const
inline
Returns
a reverse_iterator to the beginning of the range
template<class T>
reverse_iterator meta::util::basic_range< T >::rend ( ) const
inline
Returns
a reverse_iterator to the end of the range

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