Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost asio bind read handler
    primarykey
    data
    text
    <p>I am trying to bind a read handler, and boost asio is driving me crazy.</p> <p>I have the following class</p> <pre><code>class namenode_registration: public boost::enable_shared_from_this&lt;namenode_registration&gt;, private boost::noncopyable { private: [...] public: namenode_registration(....); [...] void handle_request_sent(const boost::system::error_code&amp; e); void handle_read_reply_type(boost::asio::mutable_buffers_1&amp; buffer, const boost::system::error_code&amp; e, std::size_t bytes_transferred); }; </code></pre> <p>With the following implementation :</p> <pre><code>void namenode_registration::handle_request_sent( const boost::system::error_code&amp; e) { if (!e) { boost::asio::async_read(socket_, boost::asio::buffer(buffer_data_, namenode::reply::type_size), boost::bind(&amp;namenode_registration::handle_read_reply_type, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } } </code></pre> <p>And I really can't understand why it does not compile : </p> <pre><code>In file included from /usr/include/boost/bind.hpp:22:0, from /home/.../datanode/namenode_registration.cpp:9: /usr/include/boost/bind/bind.hpp: In instantiation of ‘boost::_bi::result_traits&lt;boost::_bi::unspecified, void (datanode::namenode_registration::*)(boost::asio::mutable_buffers_1&amp;, const boost::system::error_code&amp;, long unsigned int)&gt;’: /usr/include/boost/bind/bind_template.hpp:15:48: instantiated from ‘boost::_bi::bind_t&lt;boost::_bi::unspecified, void (datanode::namenode_registration::* (boost::asio::mutable_buffers_1&amp;, const boost::system::error_code&amp;, long unsigned int), boost::_bi::list3&lt;boost::_bi::value&lt;boost::shared_ptr&lt;datanode::namenode_registration&gt; &gt;, boost::arg&lt;1&gt; (*)(), boost::arg&lt;2&gt; (*)()&gt; &gt;’ /home/.../datanode/namenode_registration.cpp:50:51: instantiated from here /usr/include/boost/bind/bind.hpp:69:37: erreur: ‘void (datanode::namenode_registration::*)(boost::asio::mutable_buffers_1&amp;, const boost::system::error_code&amp;, long unsigned int)’ is not a class, struct, or union type </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload