Closed G10h4ck closed 4 years ago
Hey, did you set CONTINUABLE_WITH_NO_EXCEPTIONS
or CONTINUABLE_WITH_CUSTOM_ERROR_TYPE
as described in https://naios.github.io/continuable/configuration.html? By default continuable uses std::exception_ptr
as cti::exception_t
and needs to be configured to use a custom value error type like std::error_condition
through a preprocessor define.
I have set CONTINUABLE_WITH_NO_EXCEPTIONS
but not CONTINUABLE_WITH_CUSTOM_ERROR_TYPE
should I set that too?
CONTINUABLE_WITH_NO_EXCEPTIONS
will set cti::exception_t
to std::error_condition
.
What I would suggest is that you outcomment your solution step by step to narrow the error source:
auto async_resolve(const asio::ip::udp::endpoint& endpoint)
{
return cti::promisify<asio::ip::udp::resolver::iterator>::with(
[](auto&& promise, auto&& e, auto&&... args)
{
/*if (e) promise.set_exception(std::forward<decltype(e)>(e));
else promise.set_value(std::forward<decltype(args)>(args)...);*/
},
[&](auto&&... args)
{
// mResolver.async_resolve(std::forward<decltype(args)>(args)...);
},
std::move(endpoint));
}
The line triggering the error is apparently just this one mControlSocket.async_connect(std::forward<decltype(args)>(args)...);
commenting that compilation is successful. Even commenting the other two and leaving only that one there the compilation fail.
Did you take a look at the example with the standalone boost? it looks quite similar https://github.com/Naios/continuable/blob/master/examples/example-asio/example-asio.cpp and I don't see any issue with your code from the continuable side, are the async_connect
parameters correct?
I have wrote that code looking at the example you pointed, sadly the example fails compiling too http://dpaste.com/3W219QC
/home/gio/Builds/continuable/examples/example-asio/example-asio.cpp:62:9: error: ‘io_context’ in namespace ‘asio’ does not name a type
this should be present in the version which is set as test dependency. in the example. Also the example is built in the CI ans should definitly be buildable as shown by latest CI builds.
Thanks for pointing this out! So it end up being the very simple problem of having an old ASIO version ( 1.10.8 ) installed on my system, while the one shipped as dependency is ( asio-1-12-0-184-g0a52abce ) so I have upgraded my system version to latest available in my distro ( 1.14.0 ) and now it compile without complains. As usual compiler error messages when making big use of C++ meta-programing doesn't help much :-.
Thanks for help again!
@Naios
I am trying to use continuable along with non-boost ASIO library, my understanding about async, and template programming is not comparable with yours, and I haven't been successful up until now, so I have been fiddling with the examples but I get compiler error I haven't been able to solve.
so in my class I have this members
then I have been defining some methods, one of them almost copy-pasted from continuable documentation is this:
but when I try to compile i get the following errors:
While trying to understand were the error came from I have been fiddling with other methods, but with each of them I have been getting similar errors, I attach those method definitions + compile errors here for completeness
compile errors:
In this latter case ASIO apparently complain of the callback type not being the expected one. The compiler I am using is GCC 8.3.0
Thanks for sharing this library and for the help!