test: use the mixin design a little more
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
#ifndef ENTT_COMMON_NEW_DELETE_H
|
||||
#define ENTT_COMMON_NEW_DELETE_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace test {
|
||||
|
||||
struct new_delete {
|
||||
static void *operator new(std::size_t count) {
|
||||
return ::operator new(count);
|
||||
}
|
||||
|
||||
static void operator delete(void *ptr) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
int value{};
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
#endif
|
||||
@@ -45,6 +45,17 @@ struct non_movable_mixin: Type {
|
||||
non_movable_mixin &operator=(const non_movable_mixin &) noexcept = default;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
struct new_delete_mixin: Type {
|
||||
static void *operator new(std::size_t count) {
|
||||
return ::operator new(count);
|
||||
}
|
||||
|
||||
static void operator delete(void *ptr) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
struct empty_type {};
|
||||
|
||||
struct aggregate_type {
|
||||
@@ -75,6 +86,8 @@ using non_trivially_destructible = internal::non_trivially_destructible_mixin<in
|
||||
using non_comparable = internal::non_comparable_mixin<internal::empty_type>;
|
||||
using non_movable = internal::non_movable_mixin<internal::value_type<int>>;
|
||||
|
||||
using new_delete = internal::new_delete_mixin<internal::value_type<int>>;
|
||||
|
||||
using boxed_int = internal::value_type<int>;
|
||||
using boxed_char = internal::value_type<char>;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <entt/core/type_info.hpp>
|
||||
#include "../../common/config.h"
|
||||
#include "../../common/linter.hpp"
|
||||
#include "../../common/new_delete.h"
|
||||
#include "../../common/value_type.h"
|
||||
|
||||
template<std::size_t Len>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <entt/entity/storage.hpp>
|
||||
#include "../../common/config.h"
|
||||
#include "../../common/linter.hpp"
|
||||
#include "../../common/new_delete.h"
|
||||
#include "../../common/throwing_allocator.hpp"
|
||||
#include "../../common/throwing_type.hpp"
|
||||
#include "../../common/tracked_memory_resource.hpp"
|
||||
|
||||
Reference in New Issue
Block a user