|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-09-11 10:52:44
Douglas Gregor <gregod_at_[hidden]> writes:
> On Thursday 11 September 2003 09:36 am, Daniel Frey wrote:
>> This new idiom should be as safe as the current one, but it uses a real
>> operator bool() for bool conversion, so no overhead can slip in. To be
>> fair, it also has one drawback: The error message a user receives when
>> converting a shared_ptr to int, float, ... is not as nice as today.
>
> My only remaining concern with the new idiom is that it breaks is_convertible.
> With the member function pointer version,
> is_convertible<something_bool_testable, int>::value == false; with the
> private conversion to an integral type, this results in a compiler error.
>
> I don't know what to do about this, or if it will break much user code, but it
> will break some code.
Breaking is_convertible is bad.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk