I am currently trying to understand the boost::asio-API. in one of my classes I use a boost::shared_ptr to reference an io_service in this way:
class myClass : public boost::asio::serial_port
{
public:
myClass(std::string Port);
private:
boost::shared_ptr<boost::asio::io_Service> _io_service_ptr;
};
And the implementation according to that is:
myClass::myClass(std::string Port) : _io_service_ptr(new boost::asio::io_service),
boost::asio::serial_port(*_io_service_ptr, Port)
{
//do stuff
}
When I do this, i get the error: Assertion failed! px != 0 [...]
When use the same pattern for other boost::asio objects (like boost::asio::io_service::work(service)) it works fine. What did i do wrong with the io_service?