Procházet zdrojové kódy

Add nodiscard keyword to prototypes

Patrick-Christopher Mattulat před 1 rokem
rodič
revize
0de08a398d
1 změnil soubory, kde provedl 14 přidání a 14 odebrání
  1. 14 14
      include/ls-math/vector/Vector2.hpp

+ 14 - 14
include/ls-math/vector/Vector2.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-08-05
- * Changed:         2022-08-07
+ * Changed:         2022-11-06
  *
  * */
 
@@ -37,26 +37,26 @@ namespace ls::math::vector
 
       // additional functionality
 
-      static ls::math::vector::Vector2 add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      static ls::math::core::type::vector_scalar dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      ls::math::core::type::vector2_components getComponents();
-      double getLength();
-      ls::math::core::type::vector2_component getX();
-      ls::math::core::type::vector2_component getY();
-      ls::math::vector::Vector2 normalize();
+      [[nodiscard]] static ls::math::vector::Vector2 add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::core::type::vector_scalar dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] ls::math::core::type::vector2_components getComponents();
+      [[nodiscard]] double getLength();
+      [[nodiscard]] ls::math::core::type::vector2_component getX();
+      [[nodiscard]] ls::math::core::type::vector2_component getY();
+      [[nodiscard]] ls::math::vector::Vector2 normalize();
       void setX(const ls::math::core::type::vector2_component& _value);
       void setY(const ls::math::core::type::vector2_component& _value);
-      static ls::math::vector::Vector2 subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::vector::Vector2 subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
 
     private:
 
       ls::math::core::type::vector2_components components{};
 
-      static ls::math::vector::Vector2 _add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      static ls::math::core::type::vector_scalar _dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      static double _getLength(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y);
-      static ls::math::vector::Vector2 _operatorDivision(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y, double _divisor);
-      static ls::math::vector::Vector2 _subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::vector::Vector2 _add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::core::type::vector_scalar _dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static double _getLength(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y);
+      [[nodiscard]] static ls::math::vector::Vector2 _operatorDivision(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y, double _divisor);
+      [[nodiscard]] static ls::math::vector::Vector2 _subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
   };
 }