Boost logo

Boost :

Subject: Re: [boost] [smart_ptr][thread][test] breaking change on shared_ptr operator bool.
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-12-11 15:38:13


On Mon, Dec 10, 2012 at 5:23 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Olaf van der Spek wrote:
>>
>> On Mon, Dec 10, 2012 at 4:27 PM, Peter Dimov <lists_at_[hidden]> wrote:
>> > Olaf van der Spek wrote:
>> >
>> >> What's the rationale for this breaking change?
>> >
>> > Compatibility with C++11?
>>
>> The 'old' boost::shared_ptr seemed to work fine on C++11.
>
>
> Sure. It seems that you're being deliberately obtuse for rhetorical reasons,
> but all right.
>
> In C++11, the idiomatic way to make a class convertible to bool is via an
> explicit operator bool. The language has been specifically changed to
> support this use case. The standard library has been changed to use this
> idiom for each of its convertible to bool types, including std::shared_ptr.
> For better or worse, this will be how convertible to bool C++11 types will
> behave.

I know. And boost::shared_ptr behaving the same as std::shared_ptr is
nice, I'm just wondering whether that's more important than
maintaining compatibility with older Boost releases.
What real problem with keeping the old behavor have?

BTW, I'm really just wondering.

-- 
Olaf

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