title: C++ How to store boost::asio::io_service as a class member
body: <p>I´m building a service class and I would like to store the ioService as a class member. Here is the code:</p>
  
  <p><strong>SocketServer.hpp</strong></p>
  
  <pre><code>class SocketServer {
  
      public:
          SocketServer(boost::asio::io_service&amp; service);
          virtual ~SocketServer();
  
     private:
          boost::asio::io_service &amp;ioService;
  </code></pre>
  
  <p>}</p>
  
  <p><strong>SocketServer.cpp</strong></p>
  
  <pre><code>    SocketServer::SocketServer(boost::asio::io_service &amp;service) :
          ioService(service) {}
  
      SocketServer::~SocketServer() {};
  </code></pre>
  
  <p>When compiling I´m getting the following error at the constructor implementation:</p>
  
  <pre><code>error: no matching function for call to ‘boost::asio::basic_socket_acceptor&lt;boost::asio::ip::tcp&gt;::basic_socket_acceptor()’
  </code></pre>
  
  <p>I know <code>ioService</code> is non copyable, but I´m trying to store its reference, not copying the object itself.</p>
  
  <p>What is happening here ? How can I solve that ?</p>