C++ Logo


Advanced search

Re: [std-proposals] Make std::bitset a C++20 range?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 30 Aug 2023 08:05:51 -0700
On Wednesday, 30 August 2023 06:40:15 PDT Hewill Kang via Std-Proposals wrote:
> If so, this means that it could interact well with the large number of
> range utilities introduced in C++20, such as:
> bitset<30> b{...};
> auto r = b | views::drop_while([](bool b) { return !b; });
> which seems reasonable to me.
> Is this an enhancement worth considering, or is it a bad idea?

Could this ever produce efficient code? Your operation above is a simple XOR.

If efficiency is not your goal, then use a byte vector instead of a bit one.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-08-30 15:05:56