P0116: Boolean conversion for Standard Library types

51 views
Skip to first unread message

Robert Kawulak

unread,
Oct 1, 2015, 9:46:08 AM10/1/15
to std-pr...@isocpp.org

Hi,

 

I've written the paper proposing addition of explicit bool conversion operator to a few Standard Library types (bitset, duration and complex).

 

I'm not attending the Kona meeting – would somebody who does be so kind to present the paper to the Commitee in my name? If so, please let me know privately.

 

Also, discussion about the proposal is welcome.

 

Best regards,

Robert

Alisdair Meredith

unread,
Oct 1, 2015, 2:56:26 PM10/1/15
to std-pr...@isocpp.org
I can see the rationale for numeric types like 'complex' and 'duration' - I strongly prefer using named functions with 'bitset' so that it is clear whether I am testing for 'any' bit being set, or 'all' bits being set.

If you are happy for me to champion under those terms, I will represent the paper.

Sent from my iPhone
--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

Tony V E

unread,
Oct 1, 2015, 3:32:00 PM10/1/15
to Standard Proposals
On Thu, Oct 1, 2015 at 2:56 PM, Alisdair Meredith <alis...@me.com> wrote:
I can see the rationale for numeric types like 'complex' and 'duration' - I strongly prefer using named functions with 'bitset' so that it is clear whether I am testing for 'any' bit being set, or 'all' bits being set.

assert(0b001010);

the boolean of a bitset should clearly be 'any' bit being set.

Robert Kawulak

unread,
Oct 2, 2015, 10:35:09 AM10/2/15
to std-pr...@isocpp.org
2015-10-01 20:56 GMT+02:00, Alisdair Meredith <alis...@me.com>:
> I strongly prefer using named functions with 'bitset' so that it is clear
> whether I am testing for 'any' bit being set, or 'all' bits being set.

Actually bitset, along with duration, was my main motivation for
working on this topic. The one thing I miss in bitset compared to
using bare unsigned ints for bitmasks is bool conversion. Like in:

if (auto errorBits = GetErrorBits() ) {
// there are some error bits set, handle this
}

I wouldn't think that there could be a confusion between any/all
semantics for bitset bool conversion. Would you agree to tentatively
keep bitset in the proposal and ask for the judgement of the rest of
the Committee?

Ville Voutilainen

unread,
Oct 2, 2015, 10:39:42 AM10/2/15
to ISO C++ Standard - Future Proposals
On 2 October 2015 at 17:35, Robert Kawulak <robert....@gmail.com> wrote:
> I wouldn't think that there could be a confusion between any/all
> semantics for bitset bool conversion. Would you agree to tentatively
> keep bitset in the proposal and ask for the judgement of the rest of
> the Committee?

If your potential paper champion wants to remove less-than-obviously-bad
portions from your paper, find a different champion. :)
Reply all
Reply to author
Forward
0 new messages