basic_test_allocator.hpp 812 B

1234567891011121314151617181920212223242526272829303132
  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. basic_test_allocator &operator=(const basic_test_allocator &other) {
  14. // necessary to avoid call suppression
  15. base::operator=(other);
  16. return *this;
  17. }
  18. bool operator==(const basic_test_allocator &other) const {
  19. return (this == &other);
  20. }
  21. };
  22. } // namespace test
  23. #endif