23 Dec
2005
23 Dec
'05
12:51 p.m.
Alo Sarv wrote: [...]
Basically I'm looking for syntax like this:
template<typename T> void process(T t) { unchain_ptr(t).foo(); } struct X { void foo() {} }; X *x = new X; process(x); process(&x); process(*x); process(boost::shared_ptr<X>(x)); // etc
Is there such an utility in Boost libraries?
mem_fn comes to mind: template<typename T> void process(T t) { mem_fn( &X::foo )( t ); } It's not exactly the same, though.