[boost-users][function] how to

19 Jan
2009
19 Jan
'09
5:37 p.m.
Hello, function<void(Base *)> funcB; function <void(Derived *)> funcD; Is it possible to convert somehow funcD --> funcB ? Thanks.

6:58 p.m.
AMDG Igor R wrote:
funcB = boost::lambda::bind(funcD, ll_static_cast<Derived*>(_1));
Great, thank you! The only problem is that my actual code uses shared_ptr<Base>, shared_ptr<Derived>, rather than plain ptrs, so the ll_static_cast doens't compile... Is it still possible to enhance the formula? :)
I don't think that there is a predefined way to do this, so you would need to create your own wrapper function object using boost::static_pointer_cast instead of static_cast. In Christ, Steven Watanabe
5969
Age (days ago)
5969
Last active (days ago)
3 comments
2 participants
participants (2)
-
Igor R
-
Steven Watanabe