C++ Logo

std-proposals

Advanced search

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

From: Hewill Kang <hewillk_at_[hidden]>
Date: Wed, 30 Aug 2023 21:40:15 +0800
Hi C++ experts,

As a classic bit operation utility in C++, std::bitset has always been
recommended for bit storage representation.

Although it lacks begin()/end() member, its interface still looks like a
container to me. I'm curious if there has been a proposal to turn it into a
C++20 range?

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?

Hewill

Received on 2023-08-30 13:40:27