boxed_type.h 463 B

12345678910111213141516171819202122232425
  1. #ifndef ENTT_COMMON_BOXED_TYPE_H
  2. #define ENTT_COMMON_BOXED_TYPE_H
  3. namespace test {
  4. template<typename Type>
  5. struct boxed_type {
  6. Type value{};
  7. operator Type() const noexcept {
  8. return value;
  9. }
  10. };
  11. template<typename Type>
  12. inline bool operator==(const boxed_type<Type> &lhs, const boxed_type<Type> &rhs) {
  13. return lhs.value == rhs.value;
  14. }
  15. using boxed_int = boxed_type<int>;
  16. using boxed_char = boxed_type<char>;
  17. } // namespace test
  18. #endif