[*] Updated SOO for SFINAE

This commit is contained in:
Reece Wilson 2023-03-22 23:07:03 +00:00
parent 387e9c231e
commit ce59f4c437
3 changed files with 49 additions and 41 deletions

View File

@ -8,5 +8,4 @@
#pragma once
#include "ClassHelpers.hpp"
#include "ModuleApi.hpp"
#include "SOO.hpp"
#include "ModuleApi.hpp"

View File

@ -38,47 +38,54 @@
vis type(AU_FOR_EACH_FIRST(_AUROXTL_INTERRFACE_SOO_EMITTER_0, _AUROXTL_INTERRFACE_SOO_EMITTER_1, ## __VA_ARGS__, (AuUInt32, uSOOSize = kSSOPaddedSize)));\
vis ~type();
#define AUROXTL_INTERFACE_SOO_HDR_EX(vis, Type, extends, targetSize, ...)\
struct Type ## SOO \
{ \
AUROXTL_INTERFACE_SOO_HDR_(vis, Type ## SOO, targetSize, ## __VA_ARGS__) \
inline extends *operator ->() \
{ \
return (extends *)this->padding; \
} \
inline operator extends&() \
{ \
return *(extends *)this->padding; \
} \
inline operator extends*() \
{ \
return (extends *)this->padding; \
} \
inline extends * AsPointer() \
{ \
return (extends *)this->padding; \
} \
\
inline const extends *operator ->() const \
{ \
return (const extends *)this->padding; \
} \
inline operator const extends&() const \
{ \
return *(const extends *)this->padding; \
} \
inline operator const extends*() const \
{ \
return (const extends *)this->padding; \
} \
inline const extends * AsPointer() const \
{ \
return (const extends *)this->padding; \
} \
}; \
#define AUROXTL_INTERFACE_SOO_HDR_EX(vis, Type, extends, targetSize, ...) \
struct Type ## SOO \
{ \
AUROXTL_INTERFACE_SOO_HDR_(vis, Type ## SOO, targetSize, ## __VA_ARGS__) \
inline auto operator ->() \
{ \
if constexpr (std::is_const_v<typename AuRemovePointer_t<decltype(this)>>) \
{ \
return (const extends *)this->padding; \
\
} \
else \
{ \
return ( extends *)this->padding; \
} \
} \
\
inline auto AsPointer() \
{ \
if constexpr (std::is_const_v<typename AuRemovePointer_t<decltype(this)>>) \
{ \
return (const extends *)this->padding; \
} \
else \
{ \
return (extends *)this->padding; \
} \
} \
inline operator extends&() \
{ \
return *(extends *)this->padding; \
} \
inline operator extends*() \
{ \
return (extends *)this->padding; \
} \
inline operator const extends&() const \
{ \
return *(const extends *)this->padding; \
} \
inline operator const extends*() const \
{ \
return (const extends *)this->padding; \
} \
}; \
\
using Type ## SOO_t = Type ## SOO;
#define AUROXTL_INTERFACE_SOO_HDR(Type, extends, targetSize, ...) \
AUROXTL_INTERFACE_SOO_HDR_EX(, Type, extends, targetSize, ## __VA_ARGS__)

View File

@ -55,6 +55,8 @@
#include <auROXTL/auBuildTime.hpp>
#include <auROXTL/Objects/SOO.hpp>
struct IAuNullDelegate
{
virtual void OnCall() = 0;