ATLAS Offline Software
Control
CxxUtils
CxxUtils
range_with_conv.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-2024 CERN for the benefit of the ATLAS collaboration.
4
*/
13
#ifndef CXXUTILS_RANGE_WITH_CONV_H
14
#define CXXUTILS_RANGE_WITH_CONV_H
15
16
17
#include <ranges>
18
#include <vector>
19
20
21
namespace
CxxUtils
{
22
23
30
template
<
class
RANGE>
31
class
range_with_conv
32
:
public
RANGE
33
{
34
public
:
35
using
RANGE::RANGE;
36
using
Elt_t
= std::ranges::range_value_t<RANGE>;
37
38
42
template
<
template
<
class
,
class
>
class
CONT,
class
ALLOC>
43
operator
CONT<Elt_t, ALLOC>()
const
44
{
45
return
CONT<Elt_t, ALLOC> (this->
begin
(), this->
end
());
46
}
47
48
52
std::vector<Elt_t>
asVector
()
const
53
{
54
return
*
this
;
55
}
56
};
57
58
59
// Stand-alone begin/end functions, findable by ADL.
60
// Needed to work around issues seen when root 6.30.04 is used with gcc14.
61
template
<
class
T>
62
auto
begin
(
range_with_conv<T>
&
s
) {
return
s
.begin(); }
63
template
<
class
T>
64
auto
begin
(
const
range_with_conv<T>
&
s
) {
return
s
.begin(); }
65
template
<
class
T>
66
auto
end
(
range_with_conv<T>
&
s
) {
return
s
.end(); }
67
template
<
class
T>
68
auto
end
(
const
range_with_conv<T>
&
s
) {
return
s
.end(); }
69
70
71
}
// namespace CxxUtils
72
73
74
#endif // not CXXUTILS_RANGE_WITH_CONV_H
python.SystemOfUnits.s
int s
Definition:
SystemOfUnits.py:131
CxxUtils::range_with_conv::asVector
std::vector< Elt_t > asVector() const
Explicit conversion to a vector.
Definition:
range_with_conv.h:52
CxxUtils
Definition:
aligned_vector.h:29
CxxUtils::end
auto end(range_with_at< T > &s)
Definition:
range_with_at.h:68
CxxUtils::range_with_conv
Add to a range class conversions to containers.
Definition:
range_with_conv.h:33
CxxUtils::range_with_conv::Elt_t
std::ranges::range_value_t< RANGE > Elt_t
Definition:
range_with_conv.h:36
CxxUtils::begin
auto begin(range_with_at< T > &s)
Definition:
range_with_at.h:64
Generated on Sat Sep 28 2024 21:24:34 for ATLAS Offline Software by
1.8.18