cpprestsdk
cpprestsdk copied to clipboard
Different behavior on different platforms
Hi, I've noticed that in Linux this code is perfectly valid and work as expected:
web::http::client::http_client client(web::uri(U("http://www.bing.com")));
web::uri_builder builder;
std::promise<int> p;
auto val = client.request( builder.to_string() )
.then( [p = std::move(p) ] ( pplx::task<web::http::http_response> task_response ) mutable
{
auto response = task_response.get();
p.set_value( 3 );
return 4;
} );
However this code won't compile on Windows, because on this line (ppltasks.h, line 3141):
return _ThenImpl<_ReturnType>(typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_StdFuncT(_Func), _Options);The callback is copied, and a std::promise has the copy ctor deleted.
I've tried different things, like defining _PPLTASKS_NO_STDFUNC, but none of them have solved the problem.
Is this a bug, is there something that I can do to get the same behavior on Linux and Windows?
Thank you very much
hi, same problem here, have you solved it?