Boost logo

Boost :

Subject: Re: [boost] [atomic] (op)_and_test naming
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-01-26 01:05:39


Mere moments ago, quoth I:
> On 26/01/2018 12:03, Peter Dimov wrote:
>> This is similar to the bool conversion of std::error_code, which is
>> also perfectly consistent and still manages to return the opposite of
>> what a certain fraction of the audience intuitively expects.

Sorry, hit Send too soon on the prior reply.

That's a different case; it's taking the "true if non-zero" convention
(the current implementation, based on the fact that internally it's an
integer-like thing) and the "true if non-empty" that is instead
implemented by things like smart pointers and optional (for similar
reasons), and then conflating it with an assumption that "empty ==
success" given that the class name is error_code. Which is usually but
not always true. The proposed change is to address that assumption by
treating it less like a number and more like an error state.

But incidentally, error_code's current implementation also goes with the
idea that non-zero is true, so it supports my case. ;)


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