[+] MSVC AuUnsafeRaiiToShared exception throw mitigation
This commit is contained in:
parent
a7a982194e
commit
04a1853ed0
@ -68,6 +68,27 @@ static auline AuSPtr<T> AuMakeShared(Args&&... args)
|
||||
}
|
||||
}
|
||||
|
||||
namespace __audetail
|
||||
{
|
||||
struct Dummy
|
||||
{
|
||||
char a;
|
||||
};
|
||||
|
||||
inline AuSPtr<Dummy> GetDummyDeleter()
|
||||
{
|
||||
static AuSPtr<Dummy> d;
|
||||
if (!d)
|
||||
{
|
||||
#if defined(AURORA_COMPILER_MSVC)
|
||||
return d;
|
||||
#endif
|
||||
d = AuMakeShared<Dummy>();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static auline AuSPtr<T> AuMakeSharedArray(AuUInt count)
|
||||
{
|
||||
@ -88,15 +109,13 @@ static auline AuSPtr<T> AuMakeSharedArray(AuUInt count)
|
||||
template <class T>
|
||||
static AuSPtr<T> AuUnsafeRaiiToShared(T *in)
|
||||
{
|
||||
return AuSPtr<T>(in, [](T *)
|
||||
{});
|
||||
return AuSPtr<T>(__audetail::GetDummyDeleter(), in);
|
||||
}
|
||||
|
||||
template <class T, class Z>
|
||||
static AuSPtr<T> AuUnsafeRaiiToShared(const AuUPtr<T, Z> &in)
|
||||
{
|
||||
return AuSPtr<T>(in.get(), [](T *)
|
||||
{});
|
||||
return AuUnsafeRaiiToShared(in.get());
|
||||
}
|
||||
|
||||
template <class T, AuUInt Z>
|
||||
|
Loading…
Reference in New Issue
Block a user