Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-03-17 05:53:19

On Sun, 16 Mar 2003 11:47:57 -0600, "David B. Held"
<dheld_at_[hidden]> wrote:

>"Gennaro Prota" <gennaro_prota_at_[hidden]> wrote in message
>> [...]
>> I don't know if it's useful or not but it's certainly usable. The fact
>> that deduction fails in your case doesn't mean it fails always; and
>> for named templates there's still the possibility to explicit specify
>> template arguments. In your case, you could do:
>> [...]
>> foo f(x, (X*)0 );
>> [...]
>The problem is that it doesn't scale very well. I would like to
>forward c'tors that take around 8-10 arguments.

What monster are you creating, man? :-) Ok, assuming that you need so
much parameters, and that there's a speed gain with using call_traits,
it's enough to add one more of them to deduce all the template
arguments. Example:

class X1 {};
class X2 {};
class X3 {};

class foo
    template <typename U1, typename U2, typename U3>
    foo(typename boost::call_traits<U1>::param_type v1,
        typename boost::call_traits<U2>::param_type v2,
        typename boost::call_traits<U3>::param_type v3,
        void(*)(U1, U2, U3)
    { }


int main()
    X1 x1;
    X2 x2;
    X3 x3;
    foo f(x1, x2, x3, (void(*)(X1, X2, X3))0 );

As ugly as sin, but shouldn't make your Frankenstein appear much worse
than it already is :-)

PS: I'm just joking!


Boost list run by bdawes at, gregod at, cpdaniel at, john at