Boost logo

Boost Users :

Subject: Re: [Boost-users] [Any] Operator ==
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2010-11-03 15:39:32


Den 03-11-2010 19:50, Nevin Liber skrev:

> It certainly isn't something I'd like to see in Boost.Any, as that
> isn't usually what people mean by equality comparable. Take the
> following example given the semantics you propose:
>
> boost::any x(0);
> boost::any y(x);
>
> assert(x == y); // fails
>
> One that forwards the work to (lhs == rhs) for the underlying objects
> is much more interesting, but would require extending Boost.Any to
> implement it. It also means defining semantics for:
>
> 1. What to do if they hold the same type
> 2. What to do if they hold different types
> 3. What to do if one side is not a Boost.Any object
> 4. What to do if operator== isn't defined for the types involved
>
> My armchair answers:
> 1. Forward to the expression lhs == rhs for the held objects
> 2. Forward to the expression lhs == rhs for the held objects

2. return false?

-Thorsten


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