[*] ...AU_SOO_COPY_BASIC as well

This commit is contained in:
Reece Wilson 2023-09-01 14:21:44 +01:00
parent ed34e32457
commit 471d04a9c8

View File

@ -10,6 +10,15 @@
***/
#pragma once
namespace ___soodetail
{
template <class T>
static void _reconstruct(T &ref)
{
new (&ref) T();
}
}
#if defined(_AUROXTL_INTERFACE_SOO_FORCE_NO_STRING)
#define _AUROXTL_INTERFACE_SOO_TYPE2NAME(Type) ""
#else
@ -88,23 +97,38 @@ 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) \
#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) \
inline Type &operator=(Type &&that) \
{ \
AuMemcpy(this->padding, that.padding, sizeof(this->padding)); \
AuMemset(that.padding, 0, sizeof(this->padding)); \
new (that) type(); \
if constexpr (AuIsConstructible_v<Type>) \
{ \
___soodetail::_reconstruct(that); \
} \
return *this; \
} \
#define AU_SOO_COPY_BASIC(Type) \
inline Type(const Type &that) \
{ \
AuMemcpy(this->padding, that.padding, sizeof(this->padding)); \
} \
\
inline Type &operator=(const Type &that) \
{ \
AuMemcpy(this->padding, that.padding, sizeof(this->padding)); \
return *this; \
}
#define AUROXTL_INTERFACE_SOO_HDR_EX(vis, Type, extends, targetSize, ...) \
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (struct {};), ## __VA_ARGS__)
AUROXTL_INTERFACE_SOO_HDR_EX2(vis, Type, extends, targetSize, (AU_SOO_COPY_BASIC(Type ## SOO); AU_SOO_MOVE_BASIC(Type ## SOO);), ## __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_SOO_MOVE_BASIC(Type ## SOO);), ## __VA_ARGS__)