LazyConstructor memory optimization

This commit is contained in:
Pavel Kirienko
2015-05-16 03:36:01 +03:00
parent eb370b08dd
commit f713ef5e00
@@ -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_;