Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-09-01 12:50:31

Fernando Cacciola <fernando_cacciola_at_[hidden]> wrote:
> Joel de Guzman <djowel_at_[hidden]> wrote in message

> Direct initialization: opt = 1
> seems right since this operation is never undefined.
> This would mirror variant's interface.


> Direct value accesing via implicit conversion: int i = opt
> seems wrong because this is the operation that can lead to undefined
> behaviour.

Doesn't have to be undefined behaviour. Aren't you throwing an
exception or something? variant throws throws a bad_get exception
when you get a reference to a T which is not the held type. I don't see
a problem why you can't do something similar.

Joel de Guzman

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