Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-12-23 07:51:50


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net