|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-12-12 16:46:32
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.devel
Sent: Thursday, December 12, 2002 6:24 PM
Subject: Re: Formal review: Optional library
> From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> > > optional<T> m(t);
> > >
> > > > foo(m, m); // comparison inside yields false
>
> where foo is
>
> void foo(optional<T> const &, optional<T> const &);
>
> > > >
> > Nop... :-)
> >
> > it compares true because get_pointer(x)==get_poiner(x) is true for any
x,
> > whether initialized or not.
>
> True. Had foo been
>
> void foo(optional<T>, optional<T>);
>
> or had the call been
>
> foo(optional<T>(t), optional<T>(t)); // corresponds to foo(&t, &t)
>
> I would have been right.
>
Ouch! Nasty :-)
OK, deep-copyness breaks pointer-semantic at some point no matter how much
you try to fake it....
But then I have to go back to my original decision of disallowing relational
operations directly, because they won't work as I wanted (with semantics
invariant under type change).
William?
Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk