9 hours, many overly andineered solutions later, this API design isn't possible due to MSVC being too much of a buggy shit fest. 1 issue in the spec, at least 1 internal msvc error, at least 2 internal internal bugs, and more cancer needs to be reported.

This commit is contained in:
Reece Wilson 2021-10-22 09:53:21 +01:00
parent a28f5285f0
commit bed16f376a

View File

@ -17,7 +17,10 @@ namespace Aurora::Async
class IWorkItem;
class IAsyncApp;
using AVoid = AuUInt8;
struct AVoid
{
AuUInt8 x[1];
};
AUKN_SYM IAsyncApp *GetAsyncApp();
@ -154,33 +157,33 @@ namespace Aurora::Async
using FVoidTask = FTask<AVoid, AVoid>;
template<class In_t = Async::AVoid, class Out_t = Async::AVoid, typename Functional_t = AuConsumer<const In_t &>>
static inline FTask<In_t, Out_t> TaskFromConsumerRefT(const Functional_t &func)
template<typename Info_t = AVoid, typename Out_t = AVoid, class ClazzImpl>
FTask<Info_t, Out_t> TaskFromConsumerRefT(ClazzImpl &&func)
{
FTask<In_t, Out_t> ret;
ret.onFrame = [=](const In_t &a) -> Out_t
FTask<Info_t, Out_t> ret;
ret.onFrame = [callable = func](const Info_t &in) -> Out_t
{
if constexpr (std::is_same_v<Functional_t, AuConsumer<const In_t &>>)
if constexpr (std::is_same_v<Out_t, AVoid>)
{
func(a);
callable(in);
return {};
}
else if constexpr (std::is_same_v<Functional_t, AuConsumer<const In_t *>>)
else
{
func(&a);
return callable(in);
}
else if constexpr (std::is_same_v<Functional_t, AuVoidFunc>)
{
func();
}
else if constexpr (std::is_same_v<Functional_t, AuSupplierConsumer<Out_t, const In_t &>>)
{
return func(a);
}
else if constexpr (std::is_same_v<Functional_t, AuConsumer<const In_t &>>)
{
func(a);
}
return Out_t{};
};
return ret;
}
template<typename Info_t = AVoid, typename Out_t = AVoid, class ClazzImpl>
FTask<Info_t, Out_t> TaskFromVoidVoid(AuVoidFunc &&func)
{
FTask<Info_t, Out_t> ret;
ret.onFrame = [callable = func](const Info_t &in) -> Out_t
{
func();
return {};
};
return ret;
}