Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>I now have a solution</strong></p> <p>The problem is that when I first tried to switch to <a href="http://en.cppreference.com/w/cpp/utility/functional/bind" rel="nofollow noreferrer"><code>std::bind</code></a> and <a href="http://en.cppreference.com/w/cpp/memory/shared_ptr" rel="nofollow noreferrer"><code>std::shared_ptr</code></a> I was still using the <code>boost::asio::placeholders</code> with <code>std::bind</code>, this resulted in a large amount of template compiler errors, so I then tried to switch piecemeal.</p> <p>I first tried switching just <code>boost::shared_ptr</code> to <code>std::shared_ptr</code>, this failed because <code>boost::bind</code> will not work with <code>std::shared_ptr</code> with out a specialisation of the template <code>get_pointer&lt;typename T&gt;</code> for <code>std::shared_ptr</code> (see: <a href="https://stackoverflow.com/questions/4682343/how-to-resolve-conflict-between-boostshared-ptr-and-using-stdshared-ptr">How to resolve conflict between boost::shared_ptr and using std::shared_ptr?</a>). </p> <p>After switching to std::shared_ptr I then switched to <code>std::bind</code>, this time using the <a href="http://en.cppreference.com/w/cpp/utility/functional/placeholders" rel="nofollow noreferrer"><code>std::placeholders</code></a>, (thanks richard) the example code now compiles and works correctly.</p> <p><strong>In order to use <code>std::bind</code> with <code>boost::asio</code> make sure that <code>std::shared_ptr</code> and the <code>std::placeholders</code> are also used.</strong></p>
 

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