|
Boost : |
From: Hartmut Kaiser (hartmutkaiser_at_[hidden])
Date: 2003-08-28 00:28:38
Fernando Cacciola wrote:
> optional<U> means that you either has or don't has an instance of U.
> The meanig of 'having' implies some sort of state, and with it,
> storage.
>
> optional<U> can be seen as a container of capacity 1 which
> might be empty.
> But how could you 'contain' something that is not an object?
What's wrong with the idiom 'holding a reference or holding nothing'?
How this is different from 'holding an object or holding nothing'? Both
ways may 'nicely' lead to undefined/unexpected behaviour, if the system
isn't designed carefully, this lies in the nature of C++, it's unlimited
power implies unlimited danger :-)
Regards Hartmut
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk