Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-01-30 10:54:09


Douglas Gregor wrote:
>> On the main branch, I've implemented operator== and operator!= for
>> Boost.Function (but not in the form you expect).

I am getting a C4800 warning from MSVC 7.1 ('int' forced to true/false) in
function_template.hpp:299:

            bool equal =
              BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type);
            return (equal? functor_ptr
                    : make_any_pointer(reinterpret_cast<void*>(0)));

That's because type_info::operator= returns an int (for ABI reasons, I
presume.)

This is a regression. The fix is trivial:

            return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)?
                      functor_ptr:
                      make_any_pointer(reinterpret_cast<void*>(0));

The definition of BOOST_FUNCTION_COMPARE_TYPE_ID is:

# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) (X==Y)

It should be:

# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X) == (Y))

Also, I'm not really sure whether we should pre-emptively "fix"
type_info::operator= like this. Bugfixes should be in response to actual bug
reports.


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