#pragma once
#include<type_traits>#include"internal/dev_env.hpp"namespaceuni{namespaceinternal{namespacebit_field{template<classFlag>structbase{usingflag=Flag;usingbit_type=typenamestd::underlying_type_t<flag>;constbit_typebits;template<class...Flags>constexprbase(Flags...flags):bits(set(flags...)){}constexprboolnone()constnoexcept(NO_EXCEPT){returnthis->bits==0;}template<class...Tail>staticconstexprbit_typetoggle(flaghead,Tail...tail)noexcept(NO_EXCEPT){returnstatic_cast<bit_type>(head)^toggle(tail...);}staticconstexprbit_typetoggle()noexcept(NO_EXCEPT){return0;}template<class...Tail>staticconstexprbit_typeset(flaghead,Tail...tail)noexcept(NO_EXCEPT){returnstatic_cast<bit_type>(head)|set(tail...);}staticconstexprbit_typeset()noexcept(NO_EXCEPT){return0;}template<class...Tail>constexprboolhas(flaghead,Tail...tail)constnoexcept(NO_EXCEPT){return(this->bits&static_cast<bit_type>(head))andhas(tail...);}constexprboolhas()constnoexcept(NO_EXCEPT){returntrue;}constexprboolhas(constbase&other)constnoexcept(NO_EXCEPT){returnthis->bits&other.bits==other.bits;}template<class...Flags>constexprboolequals(Flags...flags)constnoexcept(NO_EXCEPT){returnthis->equals(base{flags...});}constexprboolequals()constnoexcept(NO_EXCEPT){returntrue;}constexprboolequals(constbase&other)constnoexcept(NO_EXCEPT){returnthis->bits==other.bits;}};}// namespace bit_field}// namespace internal}// namespace uni