Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2003-11-24 01:55:07


Sorry if we discussed this before, but why wouldn't:

struct no_integers_except_bool
{
private:
    // None of these are defined
    operator signed char() const;
    operator unsigned char() const;
    operator signed short() const;
    operator unsigned short() const;
    operator int() const;
    operator unsigned() const;
    operator signed long() const;
    operator unsigned long() const;

#ifdef BOOST_HAS_LONG_LONG
    operator signed long long() const;
    operator unsigned long long() const;
#endif

    operator char() const;
    operator wchar_t() const;
};

block the bad effects of having an "operator bool() const"? (Your class
would inherit from this one.) Wasn't there a problem with compilers trying
to match a Boolean context to all of these operators, leading to
inaccessibility and ambiguity, instead of using "bool" as an unique exact
match?

Daryle


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