[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-users
Subject:    Re: [Boost-users] [optional] mixed (optional<T>,
From:       Marc Mutz <marc () klaralvdalens-datakonsult ! se>
Date:       2006-03-17 7:57:11
Message-ID: 200603170857.15281.marc () klaralvdalens-datakonsult ! se
[Download RAW message or body]

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@klaralvdalens-datakonsult.se, mutz@kde.org
Klarälvdalens Datakonsult AB, Platform-independent software solutions


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic