On Tue, 25 Feb 2003, David Abrahams wrote:
> namespace boost
> {
>    struct safe_bool
>    {
>        int value;
>        typedef int safe_bool::*type;
>    };
> }
>
> struct myclass
> {
>    operator boost::safe_bool::type() const
>    {
>         return expression ? &boost::safe_bool::value : 0;
>    }
> };

You don't want to do that. Add:

struct yourclass
{
  operator boost::safe_bool::type() const
  {
    return expression? &boost::safe_bool::value : 0;
  }
};

myclass m;
yourclass y;

if (m == y) {
  // what's this mean?
}

This is the reason boost::function has poisoned operator== and operator!=.

        Doug
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to