Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
master (f31105fd)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
q
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
reverse.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIKERNEL_REVERSE_H
12
#define GAUDIKERNEL_REVERSE_H
13
//
14
// provide a generic 'reverse' function for use in range-based for loops.
15
//
16
// example:
17
//
18
// #include "GaudiKernel/reverse.h"
19
// auto l = { 1,2,3,4 };
20
// for ( const auto& i : reverse( l ) ) std::cout << i << std::endl;
21
//
22
// Note that it is perfectly fine to reverse a temporary. The temporary
23
// will be moved into the reverse_wrapper, and thus kept alive for the
24
// duration of the loop. In case reverse is called on an lvalue, the wrapper
25
// will take a reference, so no copy will be performed. (if you wonder how
26
// the code below (very implicitly) distinguishes between the two cases,
27
// google for 'C++11 reference collapsing' -- short version: C++ does not
28
// allow references to references, so in cases where this would happen,
29
// one gets an lvalue reference)
30
//
31
// Also note that reverse_wrapper does not have a constructor, but this
32
// implies that it does meet the requirements for aggregate initializaton,
33
// which allows for {} initialization of its member.
34
//
35
36
#include <iterator>
37
#include <utility>
38
39
namespace
details
{
40
41
template
<
typename
Iterable>
42
struct
reverse_wrapper
{
43
Iterable
iterable
;
44
};
45
46
template
<
typename
T>
47
auto
begin
(
reverse_wrapper<T>
& w ) {
48
using
std::rbegin;
49
return
rbegin( w.
iterable
);
50
}
51
template
<
typename
T>
52
auto
end
(
reverse_wrapper<T>
& w ) {
53
using
std::rend;
54
return
rend( w.
iterable
);
55
}
56
}
// namespace details
57
58
template
<
typename
T>
59
::details::reverse_wrapper<T>
reverse
( T&& iterable ) {
60
return
{ std::forward<T>( iterable ) };
61
}
62
63
#endif
reverse
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition:
reverse.h:59
details::reverse_wrapper
Definition:
reverse.h:42
details
Definition:
AnyDataWrapper.h:19
details::begin
auto begin(reverse_wrapper< T > &w)
Definition:
reverse.h:47
details::reverse_wrapper::iterable
Iterable iterable
Definition:
reverse.h:43
details::end
auto end(reverse_wrapper< T > &w)
Definition:
reverse.h:52
GaudiKernel
include
GaudiKernel
reverse.h
Generated on Mon Apr 7 2025 16:26:23 for The Gaudi Framework by
1.8.18