1 #include "messanger_service.hpp" 2 3 namespace utils 4 { 5 6 MessangerService::MessangerService( 7 boost::asio::execution_context& execution_context) : 8 boost::asio::execution_context::service(execution_context) 9 {} 10 11 MessangerService::Context& MessangerService::create() 12 { 13 contexts_.emplace_back(std::make_unique<Context>()); 14 return *contexts_.back(); 15 } 16 17 void MessangerService::destroy(MessangerService::Context& context) 18 { 19 contexts_.erase(std::remove_if(contexts_.begin(), contexts_.end(), 20 [&context](const auto& item) { 21 return item.get() == &context; 22 }), 23 contexts_.end()); 24 } 25 26 boost::asio::execution_context::id MessangerService::id = {}; 27 28 } // namespace utils 29