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 48 of file int_range.h.

Constructor & Destructor Documentation

◆ IntRange()

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

Definition at line 81 of file int_range.h.

81  :
82  _begin(cast_int<T>(begin)),
83  _end(cast_int<T>(end))
84  {}
iterator _begin
Definition: int_range.h:91
iterator end() const
Definition: int_range.h:88
iterator begin() const
Definition: int_range.h:86
iterator _end
Definition: int_range.h:91

Member Function Documentation

◆ begin()

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

Definition at line 86 of file int_range.h.

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

86 { return _begin; }
iterator _begin
Definition: int_range.h:91

◆ end()

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

Definition at line 88 of file int_range.h.

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

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

Member Data Documentation

◆ _begin

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

Definition at line 91 of file int_range.h.

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

◆ _end

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

Definition at line 91 of file int_range.h.

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


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