Boost logo

Boost :

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

Fernando Cacciola <fernando_cacciola_at_[hidden]> wrote:

>> Even if I agree with you that an optional<T> should not be a T,
>> an optional<T> is definitely not a pointer to T.
> Definitely!
> If HTML had blinking banners I think I'd use one to state this :-)

Nor should it model a pointer. That was my point and the point
of others who dislike *opt.

> Yet iterators are not pointers either but they do use
> operators * and ->

Iterators are not pointers, but they model the pointer.

>> Right. In fact, looking at it more closely, I *could* almost agree with you
>> that an optional<T> is not a T. There is in fact a getter function (get).
>> In fact all three (tuple, optional and variant) have a get function. That's
>> fine, yet, here again, the optional does not jive well because it returns
>> access *by pointer* whereas both tuple and variant return access by
>> reference.
> This get() issue we agree should be fixed.

Agreed. If there's a way to get at the values through a generic get
function that unifies the access of optional with variant such that I
can think of optional as an optimized specialization of variant<T, none>,
I would be very happy. With such an interface, I can simply ignore
the pointer-like interface, if you wish to keep it ;-)

Thanks you very much! And BTW, kudos for such a well engineered
library! Spirit has been using it since v1.7 and I am very happy with
it. The comments I gave so far are merely my opinion. You are of
course free to have your own preferences :-)

Keep up the good work!


Joel de Guzman

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