C++ Logo

std-proposals

Advanced search

Re: Extending std::bitset

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 12 Mar 2020 22:11:52 +0200
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.

Received on 2020-03-12 15:14:51