C++ Logo


Advanced search

Making std::bitset constexpr

From: Henrik Sjöström <akilles77_at_[hidden]>
Date: Thu, 20 Jun 2019 19:27:28 +0200
Is there a reason for most members of std::bitset not to be constexpr? For
example bitset.none(), all(), any(),count().

Currently this simple program fails to compile.


int main()


constexpr std::bitset<20> bits{};

constexpr auto is_none = bits.none(); //Fails as none() isn’t constexpr


Thanks in advance,

Received on 2019-06-20 12:29:30