Removed deducing this-version again as the world (clang) isn't ready for it yet.
This commit is contained in:
parent
af51973b2a
commit
ea97d3af48
@ -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>>;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user