[*] Split off some auMemoryModel.hpp resources
This commit is contained in:
parent
37bb7e805e
commit
bdb5e3e37a
14
Include/auROXTL/MemoryModel/auArraySize.hpp
Normal file
14
Include/auROXTL/MemoryModel/auArraySize.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auArraySize.hpp
|
||||
Date: 2022-02-01 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <class T, AuUInt Z>
|
||||
constexpr AuUInt AuArraySize(const T(&array)[Z])
|
||||
{
|
||||
return Z;
|
||||
}
|
16
Include/auROXTL/MemoryModel/auOffsetOf.hpp
Normal file
16
Include/auROXTL/MemoryModel/auOffsetOf.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auOffsetOf.hpp
|
||||
Date: 2023-02-04 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <typename T, typename C>
|
||||
AuUInt AuOffsetOf(C T:: *offset)
|
||||
{
|
||||
return AuUInt(
|
||||
&(((const T *)(nullptr))->*offset)
|
||||
);
|
||||
}
|
38
Include/auROXTL/MemoryModel/auSizeOf.hpp
Normal file
38
Include/auROXTL/MemoryModel/auSizeOf.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/***
|
||||
Copyright (C) 2023-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: auSizeOf.hpp
|
||||
Date: 2023-02-04 - 2024-09-09
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf()
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T *)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const AuSPtr<T>)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T, class Del_t>
|
||||
constexpr AuUInt AuSizeOf(const AuUPtr<T, Del_t> &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
@ -59,19 +59,10 @@ static auline void AuMemoryPanic(const char *msg)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T, AuUInt Z>
|
||||
static constexpr AuUInt AuArraySize(const T(&array)[Z])
|
||||
{
|
||||
return Z;
|
||||
}
|
||||
#include "MemoryModel/auArraySize.hpp"
|
||||
#include "MemoryModel/auSizeOf.hpp"
|
||||
#include "MemoryModel/auOffsetOf.hpp"
|
||||
|
||||
template <typename T, typename C>
|
||||
static AuUInt AuOffsetOf(C T:: *offset)
|
||||
{
|
||||
return AuUInt(
|
||||
&(((const T *)(nullptr))->*offset)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static auto AuTryLockMemoryType(T weak) -> decltype(weak.lock())
|
||||
@ -91,30 +82,6 @@ static auto AuTryLockMemoryType(T weak) -> decltype(weak.lock())
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf()
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T &)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const T *)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr AuUInt AuSizeOf(const AuSPtr<T>)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template <class Z, typename T>
|
||||
static void auline AuSafeDelete(T *in)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user