ATLAS Offline Software
Loading...
Searching...
No Matches
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))
43 return this->operator[] (i);
44 }
Add at() methods to a range class.
void throw_out_of_range(const std::string &what, size_t index, size_t size, const void *obj)
Throw an out_of_range exception.

◆ 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))
51 return this->operator[] (i);
52 }

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