LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
{
21
return
*ptr;
22
}
23
};
24
25
inline
constexpr
to_element_t
to_element
;
26
}
27
28
#endif // lardata_ArtDataHelper_ToElement_h
lar::to_element
constexpr to_element_t to_element
Definition:
ToElement.h:25
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:26
lardata
v09_16_03
source
lardata
ArtDataHelper
ToElement.h
Generated on Thu May 2 2024 20:59:35 for LArSoft by
1.8.11