I totally understand if you don't want to make the conversion to normal templates (which was necessary to get around an MSVC crash on 17.1.3 - latest VS2022) - I can separate that out and just have the *this bit if you want.
When a coroutine is called as a member function (rather than a static/global) the compiler attempts to pass *this as the first argument. For a UObject that'd end up being UObject& so the existing Init(const UObject*) overload wasn't catching it.
Additionally, I had to do some SFINAE trickery on the "default" Init(TFirstArg&, TArgs&...) or else it would get called instead of the UObject overloads (probably because the object being passed in was a derivative of UObject). Not sure if there's a more elegant way to handle that.
I totally understand if you don't want to make the conversion to normal templates (which was necessary to get around an MSVC crash on 17.1.3 - latest VS2022) - I can separate that out and just have the
*this
bit if you want.When a coroutine is called as a member function (rather than a static/global) the compiler attempts to pass
*this
as the first argument. For a UObject that'd end up beingUObject&
so the existingInit(const UObject*)
overload wasn't catching it.Additionally, I had to do some SFINAE trickery on the "default"
Init(TFirstArg&, TArgs&...)
or else it would get called instead of the UObject overloads (probably because the object being passed in was a derivative of UObject). Not sure if there's a more elegant way to handle that.