Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-05-28 06:01:06


----- Original Message -----
From: "Tomasz Kowalczyk" <tomek_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, May 28, 2000 3:09 AM
Subject: [boost] nil

> Hello everybody,
>
> I would like to ask to add a nil structure to utility.hpp. It is useful
> for specifying empty arguments in template specializations. For example:
>
> template <class T1 = nil>
> struct F {
> void f(T1);
> };
>
> template <>
> struct F<> {
> void f();
> };

I don't see nil being used in the specialization... perhaps the use of a
default template parameter is just obscuring the issue?

> The definition would most like look like:
>
> namespace boost {
> struct nil {};
> }
>

> Lambda library and Peter Dimov's expression library use this technique
> extensively, and I have found myself using it a lot too. Why not to
> place a structure like this in a common, well known place, so that
> people using or contributing to boost do not have to invent the same
> thing with a different name again and again ?
>

Only one reason I can think of: there's a "universal null-pointer class"
(which is arguably more generally useful), which we probably ought to add to
the library, and the names might be easily confused. It's not a big deal,
but something to consider, maybe. What about "empty"?

-Dave


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