FWCore
Utilities
interface
getAnyPtr.h
Go to the documentation of this file.
1
#ifndef FWCore_Utilities_getAnyPtr_h
2
#define FWCore_Utilities_getAnyPtr_h
3
4
#include <cassert>
5
#include <memory>
6
7
namespace
edm
{
8
template
<
typename
T>
9
inline
std::unique_ptr<T>
getAnyPtr
(
void
*
p
,
int
offset
) {
10
// A union is used to avoid possible copies during the triple cast that would otherwise be needed.
11
// std::unique_ptr<T> edp(static_cast<T*>(static_cast<void *>(static_cast<unsigned char *>(p) + offset)));
12
union
{
13
void
* vp;
14
unsigned
char
* ucp;
15
T
*
tp
;
16
} pointerUnion;
17
assert
(
p
!=
nullptr
);
18
pointerUnion.vp =
p
;
19
pointerUnion.ucp +=
offset
;
20
return
std::unique_ptr<T>(pointerUnion.tp);
21
}
22
}
// namespace edm
23
24
#endif
edm
HLT enums.
Definition:
AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
cmsswSequenceInfo.tp
tp
Definition:
cmsswSequenceInfo.py:17
T
long double T
Definition:
Basic3DVectorLD.h:48
edm::getAnyPtr
std::unique_ptr< T > getAnyPtr(void *p, int offset)
Definition:
getAnyPtr.h:9
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:82
Generated for CMSSW Reference Manual by
1.8.16