With Boost I can create an optional in-place with:
boost::optional<boost::asio::io_service::work> work = boost::in_place(boost::ref(io_service));
And disengage it with:
work = boost::none;
With C++14 / experimental support, I can instead construct an optional in-place with:
std::experimental::optional<boost::asio::io_service::work> work;
work.emplace(boost::asio::io_service::work(io_service));
But I'm at a loss for how to disengage it...
nullopt_t
is by copyingnullopt
. – Peace