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

96  :
97  _begin(cast_int<T>(begin)),
98  _end(cast_int<T>(end))
99  {}
iterator _begin
Definition: int_range.h:106
iterator end() const
Definition: int_range.h:103
iterator begin() const
Definition: int_range.h:101

Member Function Documentation

◆ begin()

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

Definition at line 101 of file int_range.h.

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

101 { return _begin; }
iterator _begin
Definition: int_range.h:106

◆ end()

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

Definition at line 103 of file int_range.h.

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

103 { return _end; }

Member Data Documentation

◆ _begin

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

Definition at line 106 of file int_range.h.

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

◆ _end

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

Definition at line 106 of file int_range.h.

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


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