Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-06-26 12:14:42

> Is there interest in adding support for variable length
> argument lists to the preprocessor library.

Not to the Boost library version. At least, not until variadics and
placemarkers are part of C++.

OTOH, the Chaos version of the library, which is nearly complete, has
full support for variadics and placemarkers from the ground up.

> Variable length argument lists can be used in place of all
> the existing data structures (i.e lists, sequences, tuples,
> and arrays). I've put together a complete set of operations
> on variable length argument lists, including iteration,
> folds, transform, etc.

1) The Chaos library implements all algorithms generically, so there is
no need to provide a specialized construct for a specific type of data
unless is drastically more efficient to do so.

2) Variadic parameters are actually quite bad for use as a data
structure. Specifically, the lack the iterative nature of sequences in
certain contexts, the streamable capabilities of purely recursive
structure like lists, and multiple "structures" cannot be passed to the
same macro. Given variadics, a better structure is a plain tuple,

3) Without well-defined token-pasting, there is no universally sound way
of detecting the last element of a variadic structure. It is simply
impossible. The best you can do is either restrict input or use some
type of pathologically unlikely but detectable "end" value. Detection,
on something that pathological, is expensive. One other alternative is
to limit the size of the variadic data. If you do that, than you can
recursively convert each element to any value you want, and the postfix
a different value to indicate the end. Of course, if the limit is high,
that is again expensive.

Nevertheless, I'll take a look at your code...

Paul Mensonides

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