basic_test_allocator.hpp 954 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef ENTT_COMMON_BASIC_TEST_ALLOCATOR_HPP
  2. #define ENTT_COMMON_BASIC_TEST_ALLOCATOR_HPP
  3. #include <memory>
  4. #include <type_traits>
  5. namespace test {
  6. template<typename Type, typename Pocs = std::true_type>
  7. struct basic_test_allocator: std::allocator<Type> {
  8. // basic pocca/pocma/pocs allocator
  9. using base = std::allocator<Type>;
  10. using propagate_on_container_copy_assignment = std::true_type;
  11. using propagate_on_container_swap = Pocs;
  12. using std::allocator<Type>::allocator;
  13. // necessary to avoid a warning by clang-cl :)
  14. basic_test_allocator(const basic_test_allocator &other)
  15. : base{other} {
  16. }
  17. basic_test_allocator &operator=(const basic_test_allocator &other) {
  18. // necessary to avoid call suppression
  19. base::operator=(other);
  20. return *this;
  21. }
  22. bool operator==(const basic_test_allocator &other) const {
  23. return (this == &other);
  24. }
  25. };
  26. } // namespace test
  27. #endif