nuke more of the stl

This commit is contained in:
Reece Wilson 2022-01-19 18:18:13 +00:00
parent d26471b173
commit 6b9bddeeaf
13 changed files with 81 additions and 23 deletions

View File

@ -44,10 +44,10 @@ namespace Aurora::Async
AuFunction<void()> callback;
AuFunction<void()> shutdown; // error
BasicWorkStdFunc(AuFunction<void()> &&callback, AuFunction<void()> &&shutdown) : callback(std::move(callback)), shutdown(std::move(shutdown))
BasicWorkStdFunc(AuFunction<void()> &&callback, AuFunction<void()> &&shutdown) : callback(AuMove(callback)), shutdown(AuMove(shutdown))
{}
BasicWorkStdFunc(AuFunction<void()> &&callback) : callback(std::move(callback))
BasicWorkStdFunc(AuFunction<void()> &&callback) : callback(AuMove(callback))
{}
BasicWorkStdFunc(const AuFunction<void()> &callback) : callback(callback)

View File

@ -34,10 +34,10 @@ namespace Aurora::Async
WorkPairImpl() : caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(Task_t &&task) : task(std::move(task)), caller_(Async::GetCurrentWorkerPId())
WorkPairImpl(Task_t &&task) : task(AuMove(task)), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(Task_t &&task, Job_t &&callback) : task(std::move(task)), callback(std::move(callback)), caller_(Async::GetCurrentWorkerPId())
WorkPairImpl(Task_t &&task, Job_t &&callback) : task(AuMove(task)), callback(AuMove(callback)), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(const Task_t &task) : task(task), caller_(Async::GetCurrentWorkerPId())
@ -49,13 +49,13 @@ namespace Aurora::Async
WorkPairImpl(const Task_t &task, const Job_t &callback, const Info_t &info) : task(task), callback(callback), input(info), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(Task_t &&task, const Job_t &callback, const Info_t &info) : task(std::move(task)), callback(callback), input(info), caller_(Async::GetCurrentWorkerPId())
WorkPairImpl(Task_t &&task, const Job_t &callback, const Info_t &info) : task(AuMove(task)), callback(callback), input(info), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(Task_t &&task, Job_t &&callback, const Info_t &info) : task(std::move(task)), callback(std::move(callback)), input(info), caller_(Async::GetCurrentWorkerPId())
WorkPairImpl(Task_t &&task, Job_t &&callback, const Info_t &info) : task(AuMove(task)), callback(AuMove(callback)), input(info), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(Task_t &&task, Job_t &&callback, Info_t &&info) : task(std::move(task)), callback(std::move(callback)), input(std::move(info)), caller_(Async::GetCurrentWorkerPId())
WorkPairImpl(Task_t &&task, Job_t &&callback, Info_t &&info) : task(AuMove(task)), callback(AuMove(callback)), input(AuMove(info)), caller_(Async::GetCurrentWorkerPId())
{}
WorkPairImpl(const Task_t &task, const Job_t &callback, Info_t &&info) : task(task), callback(callback), input(info), caller_(Async::GetCurrentWorkerPId())

View File

@ -103,7 +103,7 @@ namespace Aurora::Memory
{
if (in == nullptr) return {};
auto heapHandle = pinThis ? GetSelfReference() : AuSPtr<Heap> {};
return std::shared_ptr<T>(in,
return AuSPtr<T>(in,
[heapHandle, in, this](T *delt)
{
if constexpr (AuIsClass_v<T>)
@ -119,7 +119,7 @@ namespace Aurora::Memory
{
auto handle = pinHeap ? heap : AuSPtr<Heap> {};
auto ptr = heap.get(); // so long as in is a valid pointer within the heap, this is fine
return std::shared_ptr<T>(in,
return AuSPtr<T>(in,
[handle, ptr](T *delt)
{
ptr->Free(delt);

View File

@ -12,10 +12,10 @@ namespace Aurora::Memory
template<bool Readonly_b>
struct MemoryView
{
using Void_t = std::conditional_t<Readonly_b, const void *, void *>;
using Void_t = AuConditional_t<Readonly_b, const void *, void *>;
template<typename T, int Z>
using StdArray_t = std::conditional_t<Readonly_b, const AuArray<T, Z>, AuArray<T, Z>>;
using StdArray_t = AuConditional_t<Readonly_b, const AuArray<T, Z>, AuArray<T, Z>>;
/*
YadaYada(MemoryView(tempstring/array/etc)) should be legal, right?
@ -119,7 +119,6 @@ namespace Aurora::Memory
template<bool Readonly_b>
struct MemoryViewStream : MemoryView<Readonly_b>
{
// template<typename T, typename std::enable_if<AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, T>::value>::type* = nullptr>
template<typename T, AU_TEMPLATE_ENABLE_WHEN(AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, T>::value)>
constexpr MemoryViewStream(T &list, AuUInt &length) : MemoryView<Readonly_b>(list), outVariable(length)
{
@ -143,7 +142,7 @@ namespace Aurora::Memory
outVariable = 0;
}
template<typename T, typename std::enable_if<AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, T>::value>::type* = nullptr>
template<typename T, typename AuEnableIf<AuIsBaseOfTemplate<AURORA_RUNTIME_AU_LIST, T>::value>::type* = nullptr>
constexpr MemoryViewStream(T &list) : MemoryView<Readonly_b>(list), outVariable(unused)
{
outVariable = 0;

View File

@ -135,7 +135,7 @@ namespace Aurora::Parse
ParseState(ConsumeStream_cb &str) : stringstream(str)
{}
ParseState(ConsumeStream_cb &&str) : stringstream(std::move(str))
ParseState(ConsumeStream_cb &&str) : stringstream(AuMove(str))
{}
ConsumeStream_cb stringstream;

View File

@ -158,8 +158,9 @@ namespace Aurora::Telemetry
NewBlackboxEntryUpdateMap map;
};
using StreamWriter = std::function<void(AuUInt8 stream, const AuUInt8 *buffer, AuUInt32 length)>;
using StreamReader = std::function<void(AuUInt8 stream, AuUInt8 *buffer, AuUInt32 &length)>;
// TODO: port to lui
using StreamWriter = AuFunction<void(AuUInt8 stream, const AuUInt8 *buffer, AuUInt32 length)>;
using StreamReader = AuFunction<void(AuUInt8 stream, AuUInt8 *buffer, AuUInt32 &length)>;
AUKN_SYM AuList<NewBlockboxEntry> ReadBlackboxStream(const StreamReader &reader);
AUKN_SYM void WriteBlackboxStream(const AuList<NewBlockboxEntry> &, StreamWriter writer);

View File

@ -13,7 +13,7 @@ namespace Aurora::Threading
class LockGuard
{
private:
using Internal_t = std::remove_pointer_t<T>;
using Internal_t = AuRemovePointer_t<T>;
public:

View File

@ -13,7 +13,7 @@ namespace Aurora::Threading
class TryLockGuard
{
private:
using Internal_t = std::remove_pointer_t<T>;
using Internal_t = AuRemovePointer_t<T>;
bool bLockSuccessful;
public:

View File

@ -69,6 +69,6 @@ namespace Aurora::Threading::Threads
// UPDATE: DONE
virtual void Detach() = 0;
virtual void ExecuteInDeadThread(std::function<void()> callback) = 0;
virtual void ExecuteInDeadThread(AuFunction<void()> callback) = 0;
};
}

View File

@ -131,6 +131,64 @@ using AuIsVoid = AuIsSame<void, T>;
template <class T>
inline constexpr bool AuIsVoid_v = AuIsVoid<T>::value;
template <class T>
struct AuRemoveReference
{
using type = T;
};
template <class T>
struct AuRemoveReference<T &>
{
using type = T;
};
template <class T>
struct AuRemoveReference<T &&>
{
using type = T;
};
template <class T>
using AuRemoveReference_t = typename AuRemoveReference<T>::type;
template <class T>
constexpr AuRemoveReference_t<T> &&AuMove(T &&arg) noexcept
{
return static_cast<AuRemoveReference_t<T> &&>(arg);
}
template<bool Test, class T = void>
struct AuEnableIf
{
};
template<class T>
struct AuEnableIf<true, T>
{
using type = T;
};
template<bool Test, class T = void>
using AuEnableIf_t = typename AuEnableIf<Test, T>::type;
template<bool Test, class T, class T2>
struct AuConditional
{
using type = T;
};
template<class T, class T2>
struct AuConditional<false, T, T2>
{
using type = T2;
};
template<bool Test, class T, class T2>
using AuConditional_t = typename AuConditional<Test, T, T2>::type;
#if !defined(AURORA_RUNTIME_AU_LIST)
#define AURORA_RUNTIME_AU_LIST std::vector

View File

@ -26,10 +26,10 @@ namespace Aurora::Async
AuFunction<void()> fail;
AuThreadPrimitives::SpinLock lock;
AsyncFuncRunnable(AuFunction<void()> &&callback) : callback(std::move(callback))
AsyncFuncRunnable(AuFunction<void()> &&callback) : callback(AuMove(callback))
{}
AsyncFuncRunnable(AuFunction<void()> &&callback, AuFunction<void()> &&fail) : callback(std::move(callback)), fail(std::move(fail))
AsyncFuncRunnable(AuFunction<void()> &&callback, AuFunction<void()> &&fail) : callback(AuMove(callback)), fail(AuMove(fail))
{}
AsyncFuncRunnable(const AuFunction<void()> &callback) : callback(callback)

View File

@ -35,7 +35,7 @@ namespace Aurora::Async
{
if (itr->ns <= time)
{
if (!AuTryInsert(pending, std::move(*itr)))
if (!AuTryInsert(pending, AuMove(*itr)))
{
break;
}

View File

@ -27,7 +27,7 @@ namespace Aurora::Console::Commands
AuSPtr<ICommandSubscriber> callback;
Command(AuString tag, Parse::ParseObject commandStructure, const AuSPtr<ICommandSubscriber> &callback) : tag(tag), commandStructure(commandStructure), callback(callback) {}
Command(AuString tag, Parse::ParseObject commandStructure, AuSPtr<ICommandSubscriber> &&callback) : tag(tag), commandStructure(commandStructure), callback(std::move(callback)) {}
Command(AuString tag, Parse::ParseObject commandStructure, AuSPtr<ICommandSubscriber> &&callback) : tag(tag), commandStructure(commandStructure), callback(AuMove(callback)) {}
};
struct CommandDispatch