Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2002-11-22 16:04:56


> > We already talked about this: pointer will add extra memory access,
> optional
> > should not (in fact it should be inlined and won't be
> different from by
> > value parameter)
> >
> You are mis-remembering our previous talk.
....

No. I do remembr that we agreed that pointer semantics is better. I still
agree with that. Nevertheless my point above was following:

Even if optional<T> has pointer semantics, unlike pointers *optional<T>
won't produce extra memory access.

> > implicit conversion to optional should not be dangerous anyway.
> >
> I disagree.
> Implicit conversions are usually problematic, but with
> optional<>, it is
> even worst, since
> (1) a conversion from an uninitialized optional is undefined
-----------------------------^
we talked about "to" conversion

> (2) the distinction between
> (a) the operation of testing whether an optional is
> initialized or not
> (b) the operation of accesing the optional value (in
> this case via a
> conversion)

we talked about "to" conversion

> Maybe, but actually, I don't think optional<> should work
> with references.
> It is supposed to wrap a 'value', not a reference/pointer.
>
> Fernando Cacciola

Why? I always did not like the fact that I need to switch to pointers when
my reference argument became optional.

Gennadiy.


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