This still doesn't quite explain it. Let's say that my fn takes a
std::string. How does D know what string to pass? An empty string? "foo"?
"hello world"? Where does the argument value come from?
-----Original Message-----
From: Oliver Kowalke
Sent: Wednesday, May 15, 2013 18:52
To: boost
Subject: Re: [boost] determine first arg of callable
013/5/15 Peter Dimov
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. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost