Boost logo

Boost Users :

From: Marc Mutz (marc_at_[hidden])
Date: 2006-03-17 02:57:11


On Tuesday 14 March 2006 11:13, Pablo Aguilar wrote:
> Wouldn't the following work?
>
>         if( t && *t == mT )

I guess if ( mT && t == *mT ) would, yes, but what's the point of using deep
comparison in the first place, then? I could just use a pointer instead.
Granted, optional<> is more efficient (no heap allocation), and I only need
to check the incoming.

Hmm, come to think of it, maybe the correct thing to do would be to have
setT() take an optional<T> const&... Implicit conversion would kick in and
the relational operators would be sufficient. So, it can most easily be
arranged to work.

Still, it would be nice if there was a sentence about this in the design
rationale.

Thanks,
Marc

-- 
Marc Mutz -- marc_at_[hidden], mutz_at_[hidden]
Klarälvdalens Datakonsult AB, Platform-independent software solutions

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net