Boost logo

Boost :

From: Hurd, Matthew (hurdm_at_[hidden])
Date: 2003-09-02 21:27:25


> From: Fernando Cacciola [mailto:fcacciola_at_[hidden]]
>
> Mat Marcus <mmarcus-boost_at_[hidden]> wrote in message
> news:136219262.1062422685@[192.168.1.103]...
> >

> > Those who answer no to the above question may
> > prefer to write code that uniformly handles T and optional<T>.
> >
> I doubt such uniformity can be implemented smoothly.
>
> > As you know, my (current) answer is no. There may be a
> third group who
> > want both. The problem is that I find that the pointer-like
> interface
> > is distracting, but that may be because I'm unfamiliar with the
> > use-cases where you might want to handle T*'s and optional<T>'s
> > uniformly or even replace raw pointers with optional<T>'s, since
> > pointers also bring allocation issues with them. Instead I
> have been
> > mainly focused on replacing T's with optional<T>'s.
>
> Being able to replace T's with optional<T>'s is indeed a
> reasonable goal. I did it myself quite a few times. But I
> don't see how this can be made as smoothly as you wish though.

I use optional<T> quite a bit and am glad T and optional<T> are different.
Saves my bacon when I do silly things, especially when something transitions
from a T to an optional<T>. Strongly typed maintenance is something I'm
thankful for.

T* and optional<T> substitutability seems fine to me.

Matt.


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