blob: 95c82ff73257416fffd0f47d71456f03d1dbdc72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#pragma once
#include <bitset>
namespace floormat {
template<typename Enum>
struct enum_bitset : std::bitset<(std::size_t)Enum::MAX> {
static_assert(std::is_same_v<std::size_t, std::common_type_t<std::size_t, std::underlying_type_t<Enum>>>);
static_assert(std::is_same_v<Enum, std::decay_t<Enum>>);
using std::bitset<(std::size_t)Enum::MAX>::bitset;
constexpr bool operator[](Enum x) const { return operator[]((std::size_t)x); }
constexpr decltype(auto) operator[](Enum x) {
return std::bitset<(std::size_t)Enum::MAX>::operator[]((std::size_t)x);
}
};
} // namespace floormat
|