Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-07-13 08:36:17


On Sunday, July 13, 2003, at 08:49 AM, Peter Dimov wrote:

> Maybe the problems are caused by overloading void_. I haven't looked
> at MPL
> recently, but as a general observation I have identified at least
> three uses
> of a void_-like entity.
>
> 1. A type parameter used to emulate a variable argument template. I use
> '_missing' for this purpose (leading underscore for implementation
> details.)
>
> template<class A1 = _missing, class A2 = _missing, ...> struct F;
>
> 2. An optional parameter that, when not supplied, has a reasonable
> (dependent) default. I use 'unspecified'.
>
> template<class R = unspecified, class F> ... bind(F f);
>
> 3. A type that is guaranteed to be distinct from all other useful
> types.
> 'nil' is what Lisp calls it; void_ is fine, too.

Another possible spelling for this animal is:

class nat {nat();};

Inspired from nan. In this case means Not A Type. It is nice and
short which comes in handy for when there are a lot of template
parameters to default. It is easily pronounceable, and won't be
confused with any other type when discussed verbally.

-Howard


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