Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-07-13 12:38:24


"Peter Dimov" <pdimov_at_[hidden]> writes:

> Maybe the problems are caused by overloading void_.

Clearly.

> 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;

I think this is the one that has the special correspondence with the
real "void", but Aleksey wanted to change its name.

> 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);

I use 'not_specified' to distinguish it from the alarming
connotations of 'unspecified' behavior.
>
> 3. A type that is guaranteed to be distinct from all other useful types.
> 'nil' is what Lisp calls it; void_ is fine, too.

It depends whether it has special meaning in the library so that it
can't be manipulated as all other types are. If so, you'd better not
use it this way.

Of course, in the case that sparked this conversation we could make
our specialization on void_ behave properly, but I'm not sure if
that's true in general.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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