libMesh
Classes | Public Member Functions | Private Attributes | List of all members
libMesh::IntRange< T > Class Template Reference

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

#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 53 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 86 of file int_range.h.

86  :
87  _begin(cast_int<T>(begin)),
88  _end(cast_int<T>(end))
89  {}

Member Function Documentation

◆ begin()

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

Definition at line 91 of file int_range.h.

91 { return _begin; }

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

◆ end()

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

Definition at line 93 of file int_range.h.

93 { return _end; }

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

Member Data Documentation

◆ _begin

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

Definition at line 96 of file int_range.h.

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

◆ _end

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

Definition at line 96 of file int_range.h.

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


The documentation for this class was generated from the following file:
libMesh::IntRange::end
iterator end() const
Definition: int_range.h:93
libMesh::IntRange::_begin
iterator _begin
Definition: int_range.h:96
libMesh::IntRange::begin
iterator begin() const
Definition: int_range.h:91
libMesh::IntRange::_end
iterator _end
Definition: int_range.h:96