Closed caiwan closed 2 years ago
Thanks for the pull request. We definitely want to support calling runtime::invoke
with a void-returning function.
Do you think you can reduce the code duplication in your change? I would think that an if constexpr
around the member invocation and another one around the return line would be enough. The type in std::optional
might need to be substituted with a std::conditional_t<std::is_void_v<U>, bool, U>>
or something of that form. There might be a more clever way to do it.
This will lead to a more fragmented implementation in general, but prevent duplication of the matching logic.
The invoke functionality should be able to work with functions with void return type. Unfortunately one of my use-cases required this, so I've prepared a quick-and-dirty fix for that. I believe this can be achieved with less repetition.