Browse Source

test: shared pointer stable type

Michele Caini 2 years ago
parent
commit
0bc946b333
1 changed files with 26 additions and 0 deletions
  1. 26 0
      test/entt/common/pointer_stable.h

+ 26 - 0
test/entt/common/pointer_stable.h

@@ -0,0 +1,26 @@
+#ifndef ENTT_COMMON_POINTER_STABLE_HPP
+#define ENTT_COMMON_POINTER_STABLE_HPP
+
+#include <type_traits>
+
+namespace test {
+
+struct pointer_stable {
+    static constexpr auto in_place_delete = true;
+    int value{};
+};
+
+inline bool operator==(const pointer_stable &lhs, const pointer_stable &rhs) {
+    return lhs.value == rhs.value;
+}
+
+inline bool operator<(const pointer_stable &lhs, const pointer_stable &rhs) {
+    return lhs.value < rhs.value;
+}
+
+// ensure that we've at least an aggregate type to test here
+static_assert(std::is_aggregate_v<test::pointer_stable>, "Not an aggregate type");
+
+} // namespace test
+
+#endif