Răsfoiți Sursa

compressed_pair: mark functions [[nodiscard]] as needed

Michele Caini 1 an în urmă
părinte
comite
e9d30cb10e
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      src/entt/core/compressed_pair.hpp

+ 2 - 2
src/entt/core/compressed_pair.hpp

@@ -200,7 +200,7 @@ public:
      * reference to the second element if `Index` is 1.
      */
     template<std::size_t Index>
-    constexpr decltype(auto) get() noexcept {
+    [[nodiscard]] constexpr decltype(auto) get() noexcept {
         if constexpr(Index == 0u) {
             return first();
         } else {
@@ -211,7 +211,7 @@ public:
 
     /*! @copydoc get */
     template<std::size_t Index>
-    constexpr decltype(auto) get() const noexcept {
+    [[nodiscard]] constexpr decltype(auto) get() const noexcept {
         if constexpr(Index == 0u) {
             return first();
         } else {