[*] Rename AuDelegate to AuConsumer

[+] Added AuSupplier
This commit is contained in:
Reece Wilson 2021-09-29 11:41:27 +01:00
parent 10a61779e9
commit 95b0e1135c
2 changed files with 17 additions and 5 deletions

View File

@ -11,8 +11,13 @@
#define AU_NO_MOVE(type) type(type&&) = delete;
#define AU_NO_COPY_NO_MOVE(type) AU_NO_COPY(type) AU_NO_MOVE(type)
#define AU_SHARED_FROM_THIS (std::static_pointer_cast<std::remove_pointer_t<decltype(this)>>(this->shared_from_this()))
#define AU_WEAK_FROM_THIS (AuWPtr<std::remove_pointer_t<decltype(this)>>(std::static_pointer_cast<std::remove_pointer_t<decltype(this)>>(this->shared_from_this())))
#if !defined(AU_SHARED_FROM_THIS)
#define AU_SHARED_FROM_THIS (std::static_pointer_cast<std::remove_pointer_t<decltype(this)>>(this->shared_from_this()))
#endif
#if !defined(AU_WEAK_FROM_THIS)
#define AU_WEAK_FROM_THIS (AuWPtr<std::remove_pointer_t<decltype(this)>>(std::static_pointer_cast<std::remove_pointer_t<decltype(this)>>(this->shared_from_this())))
#endif
#define AU_BRACKET_SCOPE(...) __VA_ARGS__
@ -76,15 +81,19 @@ name ## Shared_t name ## Shared(T... args) \
#if defined(AURORA_COMPILER_MSVC)
#define AU_NORETURN __declspec(noreturn)
#else
#elif (defined(AURORA_COMPILER_CLANG) || defined(AURORA_COMPILER_GCC))
#define AU_ALLOC __attribute__((noreturn))
#elif defined(AU_LANG_CPP)
#define AU_NORETURN [[noreturn]]
#else
#define AU_NORETURN
#endif
#if defined(AURORA_PLATFORM_WIN32)
#define AU_ALLOC __declspec(allocator)
#elif defined(AURORA_COMPILER_CLANG)
#define AU_ALLOC __declspec(allocator)
#elif defined(AURORA_COMPILER_COMMUNISM)
#elif defined(AURORA_COMPILER_GCC)
#define AU_ALLOC __attribute__((malloc))
#else
#define AU_ALLOC

View File

@ -128,7 +128,10 @@ using AuPredicate = AuFunction<bool(T)>;
using AuVoidFunc = AuFunction<void(void)>;
template<class T>
using AuDelegate = AuFunction<void(T)>;
using AuConsumer = AuFunction<void(T)>;
template<class T>
using AuSupplier = AuFunction<T(void)>;
//#include "tinyutf8.h"