Pārlūkot izejas kodu

meta: use is_void_v as needed

Michele Caini 2 gadi atpakaļ
vecāks
revīzija
c4c6ba7620
3 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 1 1
      src/entt/meta/meta.hpp
  2. 1 1
      src/entt/meta/node.hpp
  3. 1 1
      src/entt/meta/utility.hpp

+ 1 - 1
src/entt/meta/meta.hpp

@@ -183,7 +183,7 @@ class meta_any {
             if(req == internal::meta_traits::is_meta_pointer_like) {
                 if constexpr(std::is_function_v<typename std::pointer_traits<Type>::element_type>) {
                     static_cast<meta_any *>(other)->emplace<Type>(*static_cast<const Type *>(value));
-                } else if constexpr(!std::is_same_v<std::remove_const_t<typename std::pointer_traits<Type>::element_type>, void>) {
+                } else if constexpr(!std::is_void_v<std::remove_const_t<typename std::pointer_traits<Type>::element_type>>) {
                     using in_place_type = decltype(adl_meta_pointer_like<Type>::dereference(*static_cast<const Type *>(value)));
 
                     if constexpr(std::is_constructible_v<bool, Type>) {

+ 1 - 1
src/entt/meta/node.hpp

@@ -246,7 +246,7 @@ template<typename Type>
         };
     }
 
-    if constexpr(!std::is_same_v<Type, void> && !std::is_function_v<Type>) {
+    if constexpr(!std::is_void_v<Type> && !std::is_function_v<Type>) {
         node.from_void = +[](const meta_ctx &ctx, void *element, const void *as_const) {
             if(element) {
                 return meta_any{ctx, std::in_place_type<std::decay_t<Type> &>, *static_cast<std::decay_t<Type> *>(element)};

+ 1 - 1
src/entt/meta/utility.hpp

@@ -322,7 +322,7 @@ namespace internal {
 
 template<typename Policy, typename Candidate, typename... Args>
 [[nodiscard]] meta_any meta_invoke_with_args(const meta_ctx &ctx, Candidate &&candidate, Args &&...args) {
-    if constexpr(std::is_same_v<decltype(std::invoke(std::forward<Candidate>(candidate), args...)), void>) {
+    if constexpr(std::is_void_v<decltype(std::invoke(std::forward<Candidate>(candidate), args...))>) {
         std::invoke(std::forward<Candidate>(candidate), args...);
         return meta_any{ctx, std::in_place_type<void>};
     } else {