[*] SOO: force non-trivial trivial moves of storage

This commit is contained in:
Reece Wilson 2023-09-01 02:47:25 +01:00
parent aac9d68c3c
commit ed34e32457

View File

@ -88,11 +88,26 @@ struct AU_ALIGN(sizeof(AuUInt)) Type ## SOO
using Type ## SOO_t = Type ## SOO; \
using Type = Type ## SOO;
#define AU_SOO_MOVE_BASIC(type) \
inline type(type &&that) \
{ \
AuMemcpy(this->padding, that.padding, sizeof(this->padding)); \
AuMemset(that.padding, 0, sizeof(this->padding)); \
} \
\
inline type &operator=(type &&that) \
{ \
AuMemcpy(this->padding, that.padding, sizeof(this->padding)); \
AuMemset(that.padding, 0, sizeof(this->padding)); \
new (that) type(); \
return *this; \
}
#define AUROXTL_INTERFACE_SOO_HDR_EX(vis, Type, extends, targetSize, ...) \
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (struct {};), ## __VA_ARGS__)
#define AUROXTL_INTERFACE_SOO_HDR_EX_NC(vis, Type, extends, targetSize, ...) \
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (AU_NO_COPY(Type ## SOO); AU_MOVE(Type ## SOO);), ## __VA_ARGS__)
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (AU_NO_COPY(Type ## SOO); AU_SOO_MOVE_BASIC(Type ## SOO);), ## __VA_ARGS__)
#define AUROXTL_INTERFACE_SOO_HDR_EX_NCM(vis, Type, extends, targetSize, ...) \
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (AU_NO_COPY_NO_MOVE(Type ## SOO)), ## __VA_ARGS__)