The problem was my interpretation of what you meant by "properly copyable".
Thanks Lars.
2010/8/20 Lars Viklund
On Fri, Aug 20, 2010 at 04:25:07PM -0300, Mauricio Gomes wrote:
As for your initial problem of the receiver being dis-associated from the callable, it's probably because it's not properly copyable I thought the compiler would generate a copy constructor and assignment operator suitable for S. Is not the case ? -- Mau
The synthesised cctor and op= will do a member-wise copy and assignment, respectively.
If you have value members, the copy or target will contain copies of them.
If you want to share state between two instances, you need to have reference members, reference_wrapper members or pointer-type members.
Like say:
struct S1 { shared_ptr<int> x; };
or
struct S2 { boost::reference_wrapper<int> x; };
-- Lars Viklund | zao@acc.umu.se _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Mau