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

[[nodiscard]]: try to get around an issue with VS2017 (see #501)

Michele Caini 5 лет назад
Родитель
Сommit
171463faf5
3 измененных файлов с 15 добавлено и 7 удалено
  1. 1 1
      src/entt/core/monostate.hpp
  2. 2 2
      src/entt/entity/helper.hpp
  3. 12 4
      src/entt/resource/handle.hpp

+ 1 - 1
src/entt/core/monostate.hpp

@@ -38,7 +38,7 @@ struct monostate {
      * @return Stored value, if any.
      */
     template<typename Type>
-    [[nodiscard]] operator Type() const ENTT_NOEXCEPT {
+    operator Type() const ENTT_NOEXCEPT {
         return value<Type>;
     }
 

+ 2 - 2
src/entt/entity/helper.hpp

@@ -36,7 +36,7 @@ struct as_view {
      * @return A newly created view.
      */
     template<typename Exclude, typename... Component>
-    [[nodiscard]] operator entt::basic_view<Entity, Exclude, Component...>() const {
+    operator entt::basic_view<Entity, Exclude, Component...>() const {
         return reg.template view<Component...>(Exclude{});
     }
 
@@ -86,7 +86,7 @@ struct as_group {
      * @return A newly created group.
      */
     template<typename Exclude, typename Get, typename... Owned>
-    [[nodiscard]] operator entt::basic_group<Entity, Exclude, Get, Owned...>() const {
+    operator entt::basic_group<Entity, Exclude, Get, Owned...>() const {
         return reg.template group<Owned...>(Get{}, Exclude{});
     }
 

+ 12 - 4
src/entt/resource/handle.hpp

@@ -57,16 +57,24 @@ public:
     }
 
     /*! @copydoc get */
-    [[nodiscard]] operator const Resource & () const ENTT_NOEXCEPT { return get(); }
+    [[nodiscard]] operator const Resource & () const ENTT_NOEXCEPT {
+        return get();
+    }
 
     /*! @copydoc get */
-    [[nodiscard]] operator Resource & () ENTT_NOEXCEPT { return get(); }
+    [[nodiscard]] operator Resource & () ENTT_NOEXCEPT {
+        return get();
+    }
 
     /*! @copydoc get */
-    [[nodiscard]] const Resource & operator *() const ENTT_NOEXCEPT { return get(); }
+    [[nodiscard]] const Resource & operator *() const ENTT_NOEXCEPT {
+        return get();
+    }
 
     /*! @copydoc get */
-    [[nodiscard]] Resource & operator *() ENTT_NOEXCEPT { return get(); }
+    [[nodiscard]] Resource & operator *() ENTT_NOEXCEPT {
+        return get();
+    }
 
     /**
      * @brief Gets a pointer to the managed resource.