Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-12 11:00:14


From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> > Yes, I thought about that, too. But if the current swap semantics are
> > retained, it should simply be removed. Otherwise optional<T>::swap must
> > offer at least swap(T&, T&)'s guarantee.
> >
> I'm not sure I follow.
> What are swap(T&, T&) guarantees in general?
> I thought this depended on the specific type.

True, swap()'s guarantees depend on the type. If T provides a
nothrow/strong/basic swap, optional<T>::swap should be at least
nothrow/strong/basic, respectively. I think that this can be done provided
that T(T const &) is strong and T::~T is nothrow.

> Anyway, as I posted recently, I'm just about to conclude that relational
> operators
> could be properly defined as a synonim for: get_pointer(o1) .relop.
> get_pointer(o2).
> I found this definition totally consistent with pointer semantics and the
> implied
> aliasings.

Optional does not have pointer semantics. Two optionals can never alias each
other. "Consistent with pointer semantics" doesn't make sense. Optional is
not a pointer. Don't try to make it into one; you'll arrive at shared_ptr.
;-)


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