Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-08-30 17:25:34


----- Original Message -----
From: Gennadiy E. Rozental <rogeeff_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, August 30, 2001 4:22 PM
Subject: [boost] Re: Proposal: statefull objects

Hi Gennadity,

> 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.
Good.

> BUT the implementation should be
> value-based not pointer based, to eliminate dereferensing.

Actually, the implementation is somewhat confusing because I intend
optional<T> to bypass T's default constructor. It shouldn't be absolutely
any actual difference between both implementations in terms of performance
issues while accesing the values.

If I were to remove the bypass trick -which I won't-, my implementation
would use: T data ; bool initialized ; just like yours.

All the particularities you see with the implementation are there only to
support the bypassing of T::T().

>Here what
> I did. Compiled and tested on MSVC and sun workshop
>
> [SNIP]
>
I'm sure about your new assign method. It changes the semantic of optional
too much, since being a template member
I could do:

optional<int> opt ;
*opt = 3.14 ;

I don't think I like it.

Regards,

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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