Boost logo

Boost :

Subject: Re: [boost] determine first arg of callable
From: Peter Dimov (lists_at_[hidden])
Date: 2013-05-15 12:59:12


Oliver Kowalke wrote:

> void g( Q< std::string > &) {...}
> X x( g);
> x.run(); // call g() with an instance of Q< std::string > as arg
>
> struct W
> {
> void h( Q< int > &) {...}
> };
> W w;
> X x( bind( & W::h, w, _1) );
> x.run(); // call W::h() with an instance of Q< int > as arg

Interesting. Can't you get away with just passing the type to X, or even the
Q<> value itself?

X x( fn, Q<int>() );

Otherwise, your problem doesn't have a solution in general, consider

struct Fn
{
    template<class T> void operator()( Q<T> & qt );
};


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk