FWCore
Utilities
interface
Span.h
Go to the documentation of this file.
1
#ifndef FWCore_Utilities_Span_h
2
#define FWCore_Utilities_Span_h
3
4
#include <cstddef>
5
6
namespace
edm
{
7
/*
8
*An edm::Span wraps begin() and end() iterators to a contiguous sequence
9
of objects with the first element of the sequence at position zero,
10
In other words the iterators should refer to random-access containers.
11
12
To be replaced with std::Span in C++20.
13
*/
14
15
template
<
class
T>
16
class
Span
{
17
public
:
18
Span
(
T
begin
,
T
end
) :
begin_
(
begin
),
end_
(
end
) {}
19
20
T
begin
()
const
{
return
begin_
; }
21
T
end
()
const
{
return
end_
; }
22
23
bool
empty
()
const
{
return
begin_
==
end_
; }
24
auto
size
()
const
{
return
end_
-
begin_
; }
25
26
auto
const
&
operator[]
(std::size_t
idx
)
const
{
return
*(
begin_
+
idx
); }
27
28
auto
const
&
front
()
const
{
return
*
begin_
; }
29
auto
const
&
back
()
const
{
return
*(
end_
- 1); }
30
31
private
:
32
const
T
begin_
;
33
const
T
end_
;
34
};
35
};
// namespace edm
36
37
#endif
edm::Span::end_
const T end_
Definition:
Span.h:33
edm::Span::end
T end() const
Definition:
Span.h:21
edm
HLT enums.
Definition:
AlignableModifier.h:19
heavyIonCSV_trainingSettings.idx
idx
Definition:
heavyIonCSV_trainingSettings.py:5
edm::Span::begin_
const T begin_
Definition:
Span.h:32
edm::Span::begin
T begin() const
Definition:
Span.h:20
edm::Span::Span
Span(T begin, T end)
Definition:
Span.h:18
edm::Span::size
auto size() const
Definition:
Span.h:24
edm::Span::operator[]
auto const & operator[](std::size_t idx) const
Definition:
Span.h:26
edm::Span::front
auto const & front() const
Definition:
Span.h:28
edm::Span::empty
bool empty() const
Definition:
Span.h:23
edm::Span::back
auto const & back() const
Definition:
Span.h:29
T
long double T
Definition:
Basic3DVectorLD.h:48
edm::Span
Definition:
Span.h:16
Generated for CMSSW Reference Manual by
1.8.16