test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
10
std::unique_ptr<T>
getAnyPtr
(
void
*
p
,
int
offset
) {
11
// A union is used to avoid possible copies during the triple cast that would otherwise be needed.
12
// std::unique_ptr<T> edp(static_cast<T*>(static_cast<void *>(static_cast<unsigned char *>(p) + offset)));
13
union
{
14
void
* vp;
15
unsigned
char
* ucp;
16
T
* tp;
17
} pointerUnion;
18
assert
(p !=
nullptr
);
19
pointerUnion.vp =
p
;
20
pointerUnion.ucp +=
offset
;
21
std::unique_ptr<T> tp(pointerUnion.tp);
22
return
(
std::move
(tp));
23
}
24
}
25
26
#endif
assert
assert(m_qm.get())
eostools.move
def move
Definition:
eostools.py:510
hltrates_dqm_sourceclient-live_cfg.offset
tuple offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:81
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
edm::getAnyPtr
std::unique_ptr< T > getAnyPtr(void *p, int offset)
Definition:
getAnyPtr.h:10
T
long double T
Definition:
Basic3DVectorLD.h:57
Generated for CMSSW Reference Manual by
1.8.5