aggregate.h 561 B

1234567891011121314151617181920212223242526
  1. #ifndef ENTT_COMMON_AGGREGATE_H
  2. #define ENTT_COMMON_AGGREGATE_H
  3. #include <compare>
  4. #include <type_traits>
  5. namespace test {
  6. struct aggregate {
  7. int value{};
  8. [[nodiscard]] constexpr bool operator==(const aggregate &other) const noexcept {
  9. return value == other.value;
  10. }
  11. [[nodiscard]] constexpr auto operator<=>(const aggregate &other) const noexcept {
  12. return value <=> other.value;
  13. }
  14. };
  15. // ensure aggregate-ness :)
  16. static_assert(std::is_aggregate_v<test::aggregate>, "Not an aggregate type");
  17. } // namespace test
  18. #endif