Boost logo

Boost :

Subject: Re: [boost] Review Request: Variadic Macro Data library
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2011-02-21 04:05:22

On Sun, 20 Feb 2011 20:25:43 -0500, Edward Diener wrote:

> I think Paul Mensonides may be right and there is no foolproof way to
> check for a completely empty parameter list even using variadic macros.
> Further ideas ?

Trust me, I am right. About the best you can do is prohibit input that
terminates in a function-like macro name. You can generally detect
emptiness *except* for that case.

However, DATA_SIZE() => 0 is ill-conceived. An empty argument is still
an argument to the preprocessor. A better correlation is:

DATA_SIZE(,,) => 3
DATA_SIZE(,) => 2
DATA_SIZE() => 1

This is yet another reason why variadic content doesn't make for a good
data structure. There is no way to denote the empty sequence. For all
others, there are ways:

(,,) // 3-element tuple
(,) // 2-element tuple
() // 1-element tuple
     // 0-element tuple (blank)

()()() // 3-element seq
()() // 2-element seq
() // 1-element seq
       // 0-element seq (blank)

Paul Mensonides

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