ATLAS Offline Software
reverse_wrapper.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
4  */
20 #ifndef CXXUTILS_REVERSE_WRAPPER_H
21 #define CXXUTILS_REVERSE_WRAPPER_H
22 
23 
24 namespace CxxUtils {
25 
26 
31 template <class C>
33 {
34 public:
35  reverse_wrapper (C& r) : m_r (r) {}
36  auto begin() { return m_r.rbegin(); }
37  auto end() { return m_r.rend(); }
38  C& m_r;
39 };
40 
41 
45 template <class T>
46 auto make_reverse_wrapper (T& r) { return reverse_wrapper(r); }
47 
48 
49 } // namespace CxxUtils
50 
51 
52 #endif // not CXXUTILS_REVERSE_WRAPPER_H
beamspotman.r
def r
Definition: beamspotman.py:676
CxxUtils::make_reverse_wrapper
auto make_reverse_wrapper(T &r)
Make a reverse_wrapper for a given container-like object.
Definition: reverse_wrapper.h:46
CxxUtils::reverse_wrapper::reverse_wrapper
reverse_wrapper(C &r)
Definition: reverse_wrapper.h:35
CxxUtils::reverse_wrapper::end
auto end()
Definition: reverse_wrapper.h:37
CxxUtils
Definition: aligned_vector.h:29
CxxUtils::reverse_wrapper
Adapter for a container-like class to be used in a range-for so as to iterate in the reverse directio...
Definition: reverse_wrapper.h:33
CxxUtils::reverse_wrapper::m_r
C & m_r
Definition: reverse_wrapper.h:38
CxxUtils::reverse_wrapper::begin
auto begin()
Definition: reverse_wrapper.h:36