Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-21 07:52:43


----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>

> I don't know. I'd love to deprecate the TYPELIST_nn macros, but a truly
> elegant solution would be the language to support variadic arguments in
> templates. This feature, if also applicable to functions, would make a lot
> of library code that people wrote (Loki::Functor, Loki::Variant,
ScopeGuard
> come to mind) really small and nice, and would render true our dreams of a
> typesafe printf equivalent.

Agreed! if I didn't bring this up in Redmond, I meant to. There are obvious
issues your proposal doesn't handle, though (and for which I have no
solution either):

1. What if the arguments need to be taken in pairs:

template <class T1, class U1, class T2, class U2,....>
void f(T1, U1, T2, U2,...)

2. What about the "combinatoric explosion of cv-qualifiers" problem:

void f(T1&, T2&);
void f(T1&, T2 const&);
void f(T1&, T2 volatile&);
void f(T1&, T2 const volatile&);
void f(T1 const&, T2&);
void f(T1 const&, T2 const&);
void f(T1 const&, T2 volatile&);...

It's 4^n problem :-(

-Dave


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