|
Boost : |
Subject: Re: [boost] determine first arg of callable
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2013-05-15 11:52:46
013/5/15 Peter Dimov <lists_at_[hidden]>
> You've omitted the only interesting part.
template< typename Arg >
struct Q {...};
struct B
{
virtual void run() = 0;
};
template< typename Fn, typename Arg >
struct D : public B
{
Fn fn;
D( Fn fn_) : fn( fn_) {}
void run() {
Q< Arg > q;
fn( q)
} // argument construction omitted
};
struct X
{
B * b;
template< typename Fn >
X( Fn fn) : b( 0)
{
typedef typename Magic< Fn >::arg1_type arg_type;
b = new D< Fn, arg_type >( fn);
}
void run() { b->run(); }
};
I want to construct a Q<> in D::run() and pass it to fn.
Magic<> can be specialized for raw function pointers, function<> etc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk