Removed deducing this-version again as the world (clang) isn't ready for it yet.

This commit is contained in:
Patrick 2024-08-03 20:49:31 +02:00
parent af51973b2a
commit ea97d3af48

View File

@ -157,8 +157,21 @@ public:
[[nodiscard]] constexpr bool empty() const noexcept { return storage_.empty(); } [[nodiscard]] constexpr bool empty() const noexcept { return storage_.empty(); }
inline void reset() noexcept; inline void reset() noexcept;
template<typename TCallable, typename TErrorCallable = int>
auto then(TCallable&& onSuccess, TErrorCallable&& onError = 0)
{
return thenImpl(*this, std::forward<TCallable>(onSuccess), std::forward<TErrorCallable>(onError));
}
template<typename TCallable, typename TErrorCallable = int>
auto then(TCallable&& onSuccess, TErrorCallable&& onError = 0) const
{
return thenImpl(*this, std::forward<TCallable>(onSuccess), std::forward<TErrorCallable>(onError));
}
private:
template<typename TSelf, typename TCallable, typename TErrorCallable = int> template<typename TSelf, typename TCallable, typename TErrorCallable = int>
auto then(this TSelf&& self, TCallable&& onSuccess, TErrorCallable&& onError = 0) static auto thenImpl(TSelf&& self, TCallable&& onSuccess, TErrorCallable&& onError = 0)
{ {
using result_t = std::invoke_result_t<TCallable, std::add_rvalue_reference_t<TValue>>; using result_t = std::invoke_result_t<TCallable, std::add_rvalue_reference_t<TValue>>;