Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-08-30 09:21:04

----- Original Message -----
From: Vesa Karvonen <vesa.karvonen_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, August 29, 2001 5:18 PM
Subject: Re: [boost] optional vs variant vs any

> From: "Vesa Karvonen" <vesa.karvonen_at_[hidden]>
> [...]
> > I think that 'variant', 'optional', 'any' and smart pointers all have
> > similarities but also significant intentional differences.
> [...]
> > I think that all of the above concepts should be further refined. For
> > instance:
> > - 'any' could probably make use of the 'vswitch' syntax.
> > - 'variant<T,void>' seems very close to 'optional<T>'.
> > - 'variant' and 'any' might or might not make use of some pointer
> Or perhaps 'optional' could make use of 'any' and/or 'variant' syntax.
I don't think so.
optional can use pointer semantic becuase it either contains a fully
constructed value -thus you dereference it to access this value- or is
uninitialized -thus you can't dereference it but you can test it as you
would test a null pointer-.

> BTW: I find 'empty' a really bad name for a query function. It should be
> 'is_empty' to avoid unnecessary confusion. (Practically) Every C++
> I know has at some point confused 'empty' with 'clear'. In my opinion,
> following the bad naming of the standard library has very little merit.
> estimate that the cost of using 'empty' in the standard may have easily
> hundreds of thousands of dollars worth of debugging time.

Fernando Cacciola
Sierra s.r.l.

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