
AMDG Jason Turner <lefticus <at> gmail.com> writes:
<snip>
Similarly an active_object exists which creates a message thread for an object and serializes all calls to the object:
The syntax for using an active_object is a little sloppy and I am not sure I am 100% pleased with it:
active_object::active_object<TestClass> ao(new TestClass());
active_object::active_return<int> ar = ao << boost::function1<int, TestClass *>(&TestClass::getInt); int v = ar.value();
<snip>
You should not store a pointer you should store a value. If users need a pointer then they can specify it explicitly. active_object::active_object<TestClass> ao; The << operator is not appropriate. A function is better ao.execute(boost::function1<int,TestClass *>(&TestClass::getInt)); You could use operator() but that might still be confusing. ao(boost::function1<int,TestClass *>(&TestClass::getInt)); Ideally you want a0->getInt(); But this is not possible. Another possibility is (ao->*&TestClass::getInt)(); In Christ, Steven Watanabe