Browse Source

test: less sfinae, more concepts

skypjack 1 month ago
parent
commit
f28104bfac
1 changed files with 5 additions and 2 deletions
  1. 5 2
      test/common/throwing_allocator.hpp

+ 5 - 2
test/common/throwing_allocator.hpp

@@ -1,6 +1,7 @@
 #ifndef ENTT_COMMON_THROWING_ALLOCATOR_HPP
 #ifndef ENTT_COMMON_THROWING_ALLOCATOR_HPP
 #define ENTT_COMMON_THROWING_ALLOCATOR_HPP
 #define ENTT_COMMON_THROWING_ALLOCATOR_HPP
 
 
+#include <concepts>
 #include <cstddef>
 #include <cstddef>
 #include <limits>
 #include <limits>
 #include <memory>
 #include <memory>
@@ -18,12 +19,14 @@ class throwing_allocator {
     template<typename Other>
     template<typename Other>
     friend class throwing_allocator;
     friend class throwing_allocator;
 
 
-    template<typename Other, typename = std::enable_if_t<!std::is_void_v<Type> || std::is_constructible_v<std::allocator<Type>, std::allocator<Other>>>>
+    template<typename Other>
+    requires !std::is_void_v<Type> || std::constructible_from<std::allocator<Type>, std::allocator<Other>>
     throwing_allocator(int, const throwing_allocator<Other> &other)
     throwing_allocator(int, const throwing_allocator<Other> &other)
         : allocator{other.allocator},
         : allocator{other.allocator},
           config{other.config} {}
           config{other.config} {}
 
 
-    template<typename Other, typename = std::enable_if_t<std::is_void_v<Type> && !std::is_constructible_v<std::allocator<Type>, std::allocator<Other>>>>
+    template<typename Other>
+    requires std::is_void_v<Type> || std::constructible_from<std::allocator<Type>, std::allocator<Other>>
     throwing_allocator(char, const throwing_allocator<Other> &other)
     throwing_allocator(char, const throwing_allocator<Other> &other)
         : allocator{},
         : allocator{},
           config{other.config} {}
           config{other.config} {}