/* * This file is part of the DXX-Rebirth project . * It is copyright by its individual contributors, as recorded in the * project's Git history. See COPYING.txt at the top level for license * terms and a link to the Git history. */ #pragma once #include namespace dcx { /* Wrap std::bitset similar to how enumerated_array wraps std::array. * See d_array.h for a full description. */ template struct enumerated_bitset : std::bitset { using base_type = std::bitset; constexpr typename base_type::reference operator[](E position) { return this->base_type::operator[](static_cast(position)); } constexpr bool operator[](E position) const { return this->base_type::operator[](static_cast(position)); } [[nodiscard]] static constexpr bool valid_index(std::size_t s) { return s < N; } [[nodiscard]] static constexpr bool valid_index(E e) { return valid_index(static_cast(e)); } }; }