mireo / async-mqtt5

A C++17 MQTT client based on Boost.Asio.
https://spacetime.mireo.com/async-mqtt5/
Boost Software License 1.0
154 stars 11 forks source link

default-completion tokens #12

Closed klemens-morgenstern closed 3 months ago

klemens-morgenstern commented 4 months ago

With boost 1.86, there is a global default completion token, so this library should add support.

Changing this

template<typename CompletionToken> 
auto async_foo( ..., CompletionToken && token)

to

template<typename CompletionToken = typename ::boost::asio::default_completion_token<executor_type>::type> 
auto async_foo(..., CompletionToken && token = typename ::boost::asio::default_completion_token<executor_type>::type())

should do that and will allow code like this:


co_await async_foo(...); // not token needed, default is co_await-able 
ksimicevic commented 3 months ago

Resolved with 7bc1ccf072edd1c87e6c343383c27606d83e9be3.