Просмотр исходного кода

meta: remove const qualifiers from non-reference/non-pointer types

Michele Caini 1 год назад
Родитель
Сommit
c97e3d4f96
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/entt/meta/meta.hpp

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

@@ -441,7 +441,7 @@ public:
      * @return A reference to the contained instance.
      */
     template<typename Type>
-    [[nodiscard]] Type cast() const {
+    [[nodiscard]] std::remove_const_t<Type> cast() const {
         auto *const instance = try_cast<std::remove_reference_t<Type>>();
         ENTT_ASSERT(instance, "Invalid instance");
         return static_cast<Type>(*instance);
@@ -449,7 +449,7 @@ public:
 
     /*! @copydoc cast */
     template<typename Type>
-    [[nodiscard]] Type cast() {
+    [[nodiscard]] std::remove_const_t<Type> cast() {
         // forces const on non-reference types to make them work also with wrappers for const references
         auto *const instance = try_cast<std::remove_reference_t<const Type>>();
         ENTT_ASSERT(instance, "Invalid instance");