|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-08-30 14:46:43
On Thursday 30 August 2001 03:22, you wrote:
> Hi, Fernando
>
> I spend some time overlooking this discussion and realized that what
> really bother me is not the extern semantic. I agree with you that
> providing an ability to the user to write s == value and *s == value
> is not very good idea. It's confusing and error prone. So external
> semantic should be pointer-like. BUT the implementation should be
> value-based not pointer based, to eliminate dereferensing. Here what
> I did. Compiled and tested on MSVC and sun workshop
> class optional {
> public :
> typedef T value_type;
>
> // Constructors does not allow convertion from type T. Use
> *optional<T> = value; instead
> optional()
>
> : m_initialized( false ) {}
[snip]
> // Data members
> T m_v;
> bool m_initialized;
> };
This requires T to be DefaultConstructible, which is unnecessarily
restrictive.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk