ATLAS Offline Software
Public Member Functions | List of all members
CxxUtils::range_with_at< RANGE > Class Template Reference

Add at() methods to a range class. More...

#include <range_with_at.h>

Inheritance diagram for CxxUtils::range_with_at< RANGE >:
Collaboration diagram for CxxUtils::range_with_at< RANGE >:

Public Member Functions

decltype(auto) at (size_t i)
 
decltype(auto) at (size_t i) const
 

Detailed Description

template<class RANGE>
class CxxUtils::range_with_at< RANGE >

Add at() methods to a range class.

Many standard range objects allow operator[] but do not implement at(). Use this to add at() methods to a random_access_range class.

Definition at line 32 of file range_with_at.h.

Member Function Documentation

◆ at() [1/2]

template<class RANGE >
decltype(auto) CxxUtils::range_with_at< RANGE >::at ( size_t  i)
inline

Definition at line 39 of file range_with_at.h.

40  {
41  if (i >= std::size(*this))
42  throw_out_of_range (__PRETTY_FUNCTION__, i, std::size(*this), this);
43  return this->operator[] (i);
44  }

◆ at() [2/2]

template<class RANGE >
decltype(auto) CxxUtils::range_with_at< RANGE >::at ( size_t  i) const
inline

Definition at line 47 of file range_with_at.h.

48  {
49  if (i >= std::size(*this))
50  throw_out_of_range (__PRETTY_FUNCTION__, i, std::size(*this), this);
51  return this->operator[] (i);
52  }

The documentation for this class was generated from the following file:
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CxxUtils::throw_out_of_range
void throw_out_of_range(const std::string &what, size_t index, size_t size, const void *obj)
Throw an out_of_range exception.
Definition: throw_out_of_range.cxx:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
columnar::operator[]
ObjectId< CI, CM > operator[](std::size_t) const noexcept
Definition: ObjectRange.h:169