SHADE_Y3/SHADE_Engine/src/Tools/SHEnumWrapper.h

68 lines
1.7 KiB
C
Raw Normal View History

2022-12-28 20:47:20 +08:00
#pragma once
#include <iostream>
2022-12-30 15:54:45 +08:00
//namespace SHADE
//{
// template<typename BitType>
// class SHEnumWrapper
// {
// public:
// using UnderlyingType = typename std::underlying_type_t<BitType>;
//
// private:
// UnderlyingType mask;
//
// public:
//
// constexpr SHEnumWrapper(void) noexcept
// : mask{ 0 }
// {
//
// };
//
// constexpr SHEnumWrapper(BitType bit) noexcept
// : mask{ static_cast<UnderlyingType>(bit) }
// {
//
// };
//
// constexpr SHEnumWrapper(SHEnumWrapper<BitType> const& rhs) noexcept = default;
// constexpr SHEnumWrapper& operator= (SHEnumWrapper<BitType> const& rhs) noexcept = default;
//
// constexpr explicit SHEnumWrapper(UnderlyingType flags) noexcept
// : mask{ flags }
// {
//
// };
//
// constexpr SHEnumWrapper<BitType> operator| (SHEnumWrapper<BitType> const& rhs) const noexcept
// {
// return static_cast<SHEnumWrapper<BitType>> (mask | rhs.mask);
// };
//
// constexpr SHEnumWrapper<BitType> operator& (SHEnumWrapper<BitType> const& rhs) const noexcept
// {
// return static_cast<SHEnumWrapper<BitType>> (mask & rhs.mask);
// };
//
// constexpr operator UnderlyingType() const noexcept
// {
// return mask;
// };
// };
//
// template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
// inline BitType operator|(const BitType& left, const BitType& right)
// {
// return static_cast<BitType>(static_cast<int>(left) | static_cast<int>(right));
// }
//
// template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
// inline BitType operator&(const BitType& left, const BitType& right)
// {
// return static_cast<BitType>(static_cast<int>(left) & static_cast<int>(right));
// }
//
//}