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

>"Gennaro Prota" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> [...]
>> 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
{
public:
    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!


Genny.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to