then I have my expected behaviour.
Thanks,
ajneu
#include <iostream>
#include <chrono>
#include <experimental/optional>
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
#define WEIRD_BEHAVIOUR
int main()
{
boost::asio::io_service io;
std::experimental::optional<boost::asio::io_service::work> work;
#ifdef WEIRD_BEHAVIOUR
work.emplace(io);
work = std::experimental::nullopt;
#endif
boost::asio::steady_timer timer(io, std::chrono::milliseconds{1000});
timer.async_wait([](const boost::system::error_code &ec) {
std::cout << ((!ec) ? "done" : "err") << std::endl;
});
io.run();
}