vendredi 1 juillet 2016

Cannot convert result of std::bind to std::function

I'm running into trouble with the following snippet:

std::promise<int> promise;    
auto operation = [][(std::promise<int> promise) { promise.set_value(1); };
auto fn = std::bind(operation, std::move(promise));
fn();

Using clang I get the following error:

candidate template ignored: substitution failure [with _Args = <>]: implicit instantiation of undefined template 'std::__1::__bind_return<(lambda at promise.cpp:7:12), std::__1::tuple >, std::__1::tuple<>, false>' operator()(_Args&& ...__args)

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire