-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
Description
Here's an example that produces a compiler error:
#include <stlab/concurrency/future.hpp>
#include <stlab/concurrency/immediate_executor.hpp>
#include <stlab/concurrency/default_executor.hpp>
#include <iostream>
using namespace stlab;
using namespace std;
future<int> placeholder();
void do_some_thing(int, int);
template <typename Func, typename ErrFunc>
void long_send(Func &&func, ErrFunc &&err_func) {
placeholder() // returns an stlab::future<token_type>
.then(stlab::default_executor,
[_f = std::forward<Func>(func),
_error = std::forward<ErrFunc>(err_func)](auto token) mutable {
try {
do_some_thing(token, std::move(_f)());
} catch (const std::exception &error) {
std::move(_error)(error.what());
} catch (...) {
std::move(_error)("Error: unknown");
}
})
.detach();
}
int main() {
long_send([]{ return 42; },[](const auto& e){});
}Reactions are currently unavailable