mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 23:33:34 +08:00
LazyConstructor memory optimization
This commit is contained in:
@@ -26,12 +26,19 @@ namespace uavcan
|
||||
template <typename T>
|
||||
class UAVCAN_EXPORT LazyConstructor
|
||||
{
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
struct
|
||||
{
|
||||
alignas(T) unsigned char pool[sizeof(T)];
|
||||
} data_;
|
||||
#else
|
||||
union
|
||||
{
|
||||
unsigned char pool[sizeof(T)];
|
||||
long double _aligner1;
|
||||
long long _aligner2;
|
||||
} data_;
|
||||
#endif
|
||||
|
||||
T* ptr_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user