C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Extending std::bitset
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-03-12 15:11:52


On Thu, 12 Mar 2020 at 21:25, ramy koudsi via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Apologies, I must have been referring to an old spec by accident.
> C++11 and newer does indeed accept a string in one of the constructors.
>
> However, the accepted string must be zeroes and ones. This doesn't seem very feasible, especially as we get larger bitsets.
> Using current C++11 or newer, to initialize a bitset with a value of 80 bits, we would have to pass an 80 character string.
>
> For this reason I see a need for the bitset string constructor to accept another argument, indicating the base of the string.
> This way, initializing a value can be done with a much smaller string.
>
> A base can also be passed to the to_string member function, telling it to output a string in that base, instead of just zeroes and ones.

Seems like a worthy extension to me.


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups