ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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-2025 CERN for the benefit of the ATLAS collaboration.
4
*/
11
12
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
27
template
<
class
RANGE>
28
class
range_with_conv
29
:
public
RANGE
30
{
31
public
:
32
using
RANGE::RANGE;
33
using
Elt_t
= std::ranges::range_value_t<RANGE>;
34
35
39
template
<
template
<
class
,
class
>
class
CONT,
class
ALLOC>
40
operator
CONT<Elt_t, ALLOC>()
const
41
{
42
return
CONT<Elt_t, ALLOC> (this->
begin
(), this->
end
());
43
}
44
45
49
std::vector<Elt_t>
asVector
()
const
50
{
51
return
*
this
;
52
}
53
};
54
55
56
// Stand-alone begin/end functions, findable by ADL.
57
// Needed to work around issues seen when root 6.30.04 is used with gcc14.
58
template
<
class
T>
59
auto
begin
(
range_with_conv<T>
& s) {
return
s.begin(); }
60
template
<
class
T>
61
auto
begin
(
const
range_with_conv<T>
& s) {
return
s.begin(); }
62
template
<
class
T>
63
auto
end
(
range_with_conv<T>
& s) {
return
s.end(); }
64
template
<
class
T>
65
auto
end
(
const
range_with_conv<T>
& s) {
return
s.end(); }
66
67
68
}
// namespace CxxUtils
69
70
71
#endif
// not CXXUTILS_RANGE_WITH_CONV_H
CxxUtils::range_with_conv
Add to a range class conversions to containers.
Definition
range_with_conv.h:30
CxxUtils::range_with_conv::asVector
std::vector< Elt_t > asVector() const
Explicit conversion to a vector.
Definition
range_with_conv.h:49
CxxUtils::range_with_conv< typename AuxDataTraits< Payload_t >::const_span >::Elt_t
std::ranges::range_value_t< typename AuxDataTraits< Payload_t >::const_span > Elt_t
Definition
range_with_conv.h:33
CxxUtils
Definition
aligned_vector.h:29
CxxUtils::begin
const_iterator begin() const
Return a begin iterator.
CxxUtils::end
const_iterator end() const
Return an end iterator.
Generated on
for ATLAS Offline Software by
1.17.0