Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
lardata
lardata
ArtDataHelper
ToElement.h
Go to the documentation of this file.
1
#ifndef lardata_ArtDataHelper_ToElement_h
2
#define lardata_ArtDataHelper_ToElement_h
3
4
// 'to_element' is a small function object that can be presented to a
5
// transform algorithm, enabling iteration over the underlying
6
// reference instead of the Ptr (e.g.):
7
//
8
// using lar::to_element;
9
// std::vector<art::Ptr<recob::Hit>> hits = from_somewhere();
10
// for (recob::Hit const& hit : hits | ranges::views::transform(to_element)) {
11
// ...
12
// }
13
14
#include "
canvas/Persistency/Common/Ptr.h
"
15
16
namespace
lar
{
17
struct
to_element_t
{
18
template
<
typename
T>
19
T
const
&
operator()
(
art::Ptr<T>
const
& ptr)
const
{
20
return
*ptr;
21
}
22
};
23
24
inline
constexpr
to_element_t
to_element
;
25
}
26
27
#endif // lardata_ArtDataHelper_ToElement_h
lar::to_element
constexpr to_element_t to_element
Definition:
ToElement.h:24
ValidateOpDetSimulation.T
T
Definition:
ValidateOpDetSimulation.py:52
lar::to_element_t
Definition:
ToElement.h:17
lar::to_element_t::operator()
T const & operator()(art::Ptr< T > const &ptr) const
Definition:
ToElement.h:19
Ptr.h
lar
LArSoft-specific namespace.
Definition:
EnsureOnlyOneSchedule.h:24
art::Ptr
Definition:
fwd.h:31
Generated by
1.8.11