Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Range< T > Class Template Reference

A custom range implementation around std::vector<T>s. More...

#include <Range.hpp>

Public Types

using It = typename std::vector< T >::iterator
 Shortcut for the iterator. More...
 

Public Member Functions

 Range ()=default
 Creates an empty range.
 
 Range (It begin, It end)
 Creates a Range defined by two iterators. More...
 
 Range (const Range &rhs)
 Constructs a new Range object from a given Range object. More...
 
 Range (std::vector< T > &vec)
 
Range< T > & operator= (const Range< T > &rhs)
 Copy assignment constructor. More...
 
It begin () const
 
It end () const
 
bool empty () const
 

Detailed Description

template<typename T>
class Range< T >

A custom range implementation around std::vector<T>s.

An instance can be created as a copy of a vector or just with to iterators. This allows a more efficient way to pass sub ranges around.

Template Parameters
TType of element

Definition at line 37 of file Range.hpp.

Member Typedef Documentation

◆ It

template<typename T >
using Range< T >::It = typename std::vector<T>::iterator

Shortcut for the iterator.

Definition at line 42 of file Range.hpp.

Constructor & Destructor Documentation

◆ Range() [1/3]

template<typename T >
Range< T >::Range ( It  begin,
It  end 
)
inline

Creates a Range defined by two iterators.

Parameters
beginIterator pointing to the begin of the range.
endIterator pointing to one past the last element of the range.

Definition at line 54 of file Range.hpp.

◆ Range() [2/3]

template<typename T >
Range< T >::Range ( const Range< T > &  rhs)
inline

Constructs a new Range object from a given Range object.

Parameters
rhsThe Range object to copy from.

Definition at line 61 of file Range.hpp.

◆ Range() [3/3]

template<typename T >
Range< T >::Range ( std::vector< T > &  vec)
inlineexplicit

Construct a range from a vector.

Copies the vector.

Parameters
vec

Definition at line 78 of file Range.hpp.

◆ ~Range()

template<typename T >
virtual Range< T >::~Range ( )
inlinevirtual

Definition at line 129 of file Range.hpp.

Member Function Documentation

◆ begin()

template<typename T >
It Range< T >::begin ( ) const
inline

Iterator to the beginning of the range

Returns

Definition at line 114 of file Range.hpp.

◆ empty()

template<typename T >
bool Range< T >::empty ( ) const
inline

Whether the range contains no elements

Returns
true if the range is empty

Definition at line 127 of file Range.hpp.

◆ end()

template<typename T >
It Range< T >::end ( ) const
inline

Iterator to the end of the range

Returns

Definition at line 121 of file Range.hpp.

◆ operator=()

template<typename T >
Range< T > & Range< T >::operator= ( const Range< T > &  rhs)
inline

Copy assignment constructor.

If the right hand side was constructed from a vector it is copied as well and the original vector is deleted. Otherwise the ranges are copied.

Parameters
rhsRight hand side of the assignment
Returns
The copied element

Definition at line 90 of file Range.hpp.


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