Howard Hinnant wrote: > 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.
Yep. But I don't think defaulting to 'nat' is correct; defaults in this case are 'missing'. You can make a list of nat's, and this is not an empty list. IOW with: template<class A1 = nat, class A2 = nat, ...> struct list; you can't tell the difference between list<>, list<nat>, list<nat, nat>... In Lisp this would correspond to () (which is also nil there), (nil), (nil nil), ... _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost