libMesh::IntRange< T > Class Template Reference

#include <int_range.h>

Classes

class  iterator
 

Public Member Functions

template<typename U , typename V >
 IntRange (U begin, V end)
 
iterator begin () const
 
iterator end () const
 

Private Attributes

iterator _begin
 
iterator _end
 

Detailed Description

template<typename T>
class libMesh::IntRange< T >

The IntRange templated class is intended to make it easy to loop over integers which are indices of a container.

In cases where such a range is defined by the result of a virtual function call, this allows range-based for loops to be easily written which make only a single such call, rather than a new call for each iteration.

We perform a cast_int operation (no-op in opt mode, test+assert in debug) at construction time to make sure that the given range bounds are representable by the given range type.

Author
Roy H. Stogner

Definition at line 51 of file int_range.h.

Constructor & Destructor Documentation

◆ IntRange()

template<typename T>
template<typename U , typename V >
libMesh::IntRange< T >::IntRange ( begin,
end 
)
inline

Definition at line 84 of file int_range.h.

84  :
85  _begin(cast_int<T>(begin)),
86  _end(cast_int<T>(end))
87  {}
iterator _begin
Definition: int_range.h:94
iterator end() const
Definition: int_range.h:91
iterator begin() const
Definition: int_range.h:89
iterator _end
Definition: int_range.h:94

Member Function Documentation

◆ begin()

template<typename T>
iterator libMesh::IntRange< T >::begin ( ) const
inline

Definition at line 89 of file int_range.h.

References libMesh::IntRange< T >::_begin.

89 { return _begin; }
iterator _begin
Definition: int_range.h:94

◆ end()

template<typename T>
iterator libMesh::IntRange< T >::end ( ) const
inline

Definition at line 91 of file int_range.h.

References libMesh::IntRange< T >::_end.

91 { return _end; }
iterator _end
Definition: int_range.h:94

Member Data Documentation

◆ _begin

template<typename T>
iterator libMesh::IntRange< T >::_begin
private

Definition at line 94 of file int_range.h.

Referenced by libMesh::IntRange< T >::begin().

◆ _end

template<typename T>
iterator libMesh::IntRange< T >::_end
private

Definition at line 94 of file int_range.h.

Referenced by libMesh::IntRange< T >::end().


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