Hello,
Can you please help me uncomment out the last "bind" of the program
pasted below? The problem is that it will require some kind of
mechanism to dereference the shared_ptr.
Thank you,
Chris
===
#include
#include
#include
#include
#include
using namespace boost;
struct C : noncopyable { C() {} void f() {} };
shared_ptr<C> GetC(int) { return make_shared<C>(); }
int main()
{
function x = bind(&C::f, _1);
function y = bind(&C::f, _1);
// Call x after first computing 42, GetC, and shared_ptr::operator*
x(*GetC(42));
// Same as above, but with bind and ref
bind(x, ref(*GetC(42)))();
// Similar to above, but delay calling 42, GetC, shared_ptr::operator*,
// and ref until later. Also use y (takes a shared_ptr) vs x (that takes
// a reference)
bind(y, bind(GetC, _1))(42);
// Same as above, but use x vs y
// todo: add call to operator*
// todo: add call to ref
//
// bind(x, bind(GetC, _1))(42);
return 0;
}