Skip to content

Commit

Permalink
Add noexcept keywords to vector math classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Dec 24, 2015
1 parent 48b4e60 commit 1ba5c18
Show file tree
Hide file tree
Showing 16 changed files with 463 additions and 414 deletions.
32 changes: 16 additions & 16 deletions include/Pomdog/Math/detail/FloatingPointMatrix2x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,35 @@ class POMDOG_EXPORT FloatingPointMatrix2x2 {
FloatingPointMatrix2x2(T m00, T m01, T m10, T m11) noexcept;

// Assignment operators:
FloatingPointMatrix2x2 & operator*=(FloatingPointMatrix2x2 const& other);
FloatingPointMatrix2x2 & operator+=(FloatingPointMatrix2x2 const& other);
FloatingPointMatrix2x2 & operator-= (FloatingPointMatrix2x2 const& other);
FloatingPointMatrix2x2 & operator*=(T scaleFactor);
FloatingPointMatrix2x2 & operator*=(FloatingPointMatrix2x2 const& other) noexcept;
FloatingPointMatrix2x2 & operator+=(FloatingPointMatrix2x2 const& other) noexcept;
FloatingPointMatrix2x2 & operator-= (FloatingPointMatrix2x2 const& other) noexcept;
FloatingPointMatrix2x2 & operator*=(T scaleFactor) noexcept;
FloatingPointMatrix2x2 & operator/=(T scaleFactor);

// Unary operators:
FloatingPointMatrix2x2 operator+() const;
FloatingPointMatrix2x2 operator-() const;
FloatingPointMatrix2x2 operator+() const noexcept;
FloatingPointMatrix2x2 operator-() const noexcept;

// Binary operators:
FloatingPointMatrix2x2 operator+(FloatingPointMatrix2x2 const& other) const;
FloatingPointMatrix2x2 operator-(FloatingPointMatrix2x2 const& other) const;
FloatingPointMatrix2x2 operator*(FloatingPointMatrix2x2 const& other) const;
FloatingPointMatrix2x2 operator*(T scaleFactor) const;
FloatingPointMatrix2x2 operator+(FloatingPointMatrix2x2 const& other) const noexcept;
FloatingPointMatrix2x2 operator-(FloatingPointMatrix2x2 const& other) const noexcept;
FloatingPointMatrix2x2 operator*(FloatingPointMatrix2x2 const& other) const noexcept;
FloatingPointMatrix2x2 operator*(T scaleFactor) const noexcept;
FloatingPointMatrix2x2 operator/(T scaleFactor) const;

bool operator==(FloatingPointMatrix2x2 const& other) const;
bool operator!=(FloatingPointMatrix2x2 const& other) const;
bool operator==(FloatingPointMatrix2x2 const& other) const noexcept;
bool operator!=(FloatingPointMatrix2x2 const& other) const noexcept;

// Function-call operators:
T const& operator()(std::size_t row, std::size_t column) const;
T & operator()(std::size_t row, std::size_t column);

FloatingPointMatrix2x2 Concatenate(FloatingPointMatrix2x2 const& other) const;
FloatingPointMatrix2x2 Concatenate(FloatingPointMatrix2x2 const& other) const noexcept;

FloatingPointMatrix2x2 Concatenate(T scaleFactor) const;
FloatingPointMatrix2x2 Concatenate(T scaleFactor) const noexcept;

T Determinant() const;
T Determinant() const noexcept;

///@brief Returns pointer to the first element.
T const* Data() const noexcept;
Expand All @@ -74,7 +74,7 @@ class POMDOG_EXPORT FloatingPointMatrix2x2 {

template <typename T>
FloatingPointMatrix2x2<T> POMDOG_EXPORT
operator*(T scaleFactor, FloatingPointMatrix2x2<T> const& matrix);
operator*(T scaleFactor, FloatingPointMatrix2x2<T> const& matrix) noexcept;

} // namespace Detail
} // namespace Pomdog
48 changes: 24 additions & 24 deletions include/Pomdog/Math/detail/FloatingPointMatrix3x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,35 @@ class POMDOG_EXPORT FloatingPointMatrix3x2 {
T m20, T m21) noexcept;

// Assignment operators:
FloatingPointMatrix3x2 & operator*=(FloatingPointMatrix3x2 const& other);
FloatingPointMatrix3x2 & operator+=(FloatingPointMatrix3x2 const& other);
FloatingPointMatrix3x2 & operator-=(FloatingPointMatrix3x2 const& other);
FloatingPointMatrix3x2 & operator*=(T scaleFactor);
FloatingPointMatrix3x2 & operator*=(FloatingPointMatrix3x2 const& other) noexcept;
FloatingPointMatrix3x2 & operator+=(FloatingPointMatrix3x2 const& other) noexcept;
FloatingPointMatrix3x2 & operator-=(FloatingPointMatrix3x2 const& other) noexcept;
FloatingPointMatrix3x2 & operator*=(T scaleFactor) noexcept;
FloatingPointMatrix3x2 & operator/=(T scaleFactor);

// Unary operators:
FloatingPointMatrix3x2 operator+() const;
FloatingPointMatrix3x2 operator-() const;
FloatingPointMatrix3x2 operator+() const noexcept;
FloatingPointMatrix3x2 operator-() const noexcept;

// Binary operators:
FloatingPointMatrix3x2 operator+(FloatingPointMatrix3x2 const& other) const;
FloatingPointMatrix3x2 operator-(FloatingPointMatrix3x2 const& other) const;
FloatingPointMatrix3x2 operator*(FloatingPointMatrix3x2 const& other) const;
FloatingPointMatrix3x2 operator*(T scaleFactor) const;
FloatingPointMatrix3x2 operator+(FloatingPointMatrix3x2 const& other) const noexcept;
FloatingPointMatrix3x2 operator-(FloatingPointMatrix3x2 const& other) const noexcept;
FloatingPointMatrix3x2 operator*(FloatingPointMatrix3x2 const& other) const noexcept;
FloatingPointMatrix3x2 operator*(T scaleFactor) const noexcept;
FloatingPointMatrix3x2 operator/(T scaleFactor) const;

bool operator==(FloatingPointMatrix3x2 const& other) const;
bool operator!=(FloatingPointMatrix3x2 const& other) const;
bool operator==(FloatingPointMatrix3x2 const& other) const noexcept;
bool operator!=(FloatingPointMatrix3x2 const& other) const noexcept;

// Function-call operators:
T const& operator()(std::size_t row, std::size_t column) const;
T & operator()(std::size_t row, std::size_t column);

T Determinant() const;
T Determinant() const noexcept;

FloatingPointMatrix3x2 Concatenate(FloatingPointMatrix3x2 const& other) const;
FloatingPointMatrix3x2 Concatenate(FloatingPointMatrix3x2 const& other) const noexcept;

FloatingPointMatrix3x2 Concatenate(T scaleFactor) const;
FloatingPointMatrix3x2 Concatenate(T scaleFactor) const noexcept;

static void
Invert(FloatingPointMatrix3x2 const& matrix, FloatingPointMatrix3x2 & result);
Expand All @@ -73,22 +73,22 @@ class POMDOG_EXPORT FloatingPointMatrix3x2 {
Invert(FloatingPointMatrix3x2 const& matrix);

static void
CreateTranslation(FloatingPointVector2<T> const& position, FloatingPointMatrix3x2 & result);
CreateTranslation(FloatingPointVector2<T> const& position, FloatingPointMatrix3x2 & result) noexcept;

static FloatingPointMatrix3x2
CreateTranslation(FloatingPointVector2<T> const& position);
CreateTranslation(FloatingPointVector2<T> const& position) noexcept;

static void
CreateScale(T scale, FloatingPointMatrix3x2 & result);
CreateScale(T scale, FloatingPointMatrix3x2 & result) noexcept;

static FloatingPointMatrix3x2
CreateScale(T scale);
CreateScale(T scale) noexcept;

static void
CreateScale(FloatingPointVector2<T> const& scale, FloatingPointMatrix3x2 & result);
CreateScale(FloatingPointVector2<T> const& scale, FloatingPointMatrix3x2 & result) noexcept;

static FloatingPointMatrix3x2
CreateScale(FloatingPointVector2<T> const& scale);
CreateScale(FloatingPointVector2<T> const& scale) noexcept;

static void
CreateRotation(Radian<T> const& angle, FloatingPointMatrix3x2 & result);
Expand All @@ -104,11 +104,11 @@ class POMDOG_EXPORT FloatingPointMatrix3x2 {

static void
CreateLerp(FloatingPointMatrix3x2 const& source1, FloatingPointMatrix3x2 const& source2,
T amount, FloatingPointMatrix3x2 & result);
T amount, FloatingPointMatrix3x2 & result) noexcept;

static FloatingPointMatrix3x2
CreateLerp(FloatingPointMatrix3x2 const& source1, FloatingPointMatrix3x2 const& source2,
T amount);
T amount) noexcept;

///@brief Returns pointer to the first element.
T const* Data() const noexcept;
Expand All @@ -121,7 +121,7 @@ class POMDOG_EXPORT FloatingPointMatrix3x2 {

template <typename T>
FloatingPointMatrix3x2<T> POMDOG_EXPORT
operator*(T scaleFactor, FloatingPointMatrix3x2<T> const& matrix);
operator*(T scaleFactor, FloatingPointMatrix3x2<T> const& matrix) noexcept;

} // namespace Detail
} // namespace Pomdog
56 changes: 28 additions & 28 deletions include/Pomdog/Math/detail/FloatingPointMatrix3x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,50 +36,50 @@ class POMDOG_EXPORT FloatingPointMatrix3x3 {
T m20, T m21, T m22) noexcept;

// Assignment operators:
FloatingPointMatrix3x3 & operator*=(FloatingPointMatrix3x3 const& other);
FloatingPointMatrix3x3 & operator+=(FloatingPointMatrix3x3 const& other);
FloatingPointMatrix3x3 & operator-=(FloatingPointMatrix3x3 const& other);
FloatingPointMatrix3x3 & operator*=(T scaleFactor);
FloatingPointMatrix3x3 & operator*=(FloatingPointMatrix3x3 const& other) noexcept;
FloatingPointMatrix3x3 & operator+=(FloatingPointMatrix3x3 const& other) noexcept;
FloatingPointMatrix3x3 & operator-=(FloatingPointMatrix3x3 const& other) noexcept;
FloatingPointMatrix3x3 & operator*=(T scaleFactor) noexcept;
FloatingPointMatrix3x3 & operator/=(T scaleFactor);

// Unary operators:
FloatingPointMatrix3x3 operator+() const;
FloatingPointMatrix3x3 operator-() const;
FloatingPointMatrix3x3 operator+() const noexcept;
FloatingPointMatrix3x3 operator-() const noexcept;

// Binary operators:
FloatingPointMatrix3x3 operator+(FloatingPointMatrix3x3 const& other) const;
FloatingPointMatrix3x3 operator-(FloatingPointMatrix3x3 const& other) const;
FloatingPointMatrix3x3 operator*(FloatingPointMatrix3x3 const& other) const;
FloatingPointMatrix3x3 operator*(T scaleFactor) const;
FloatingPointMatrix3x3 operator+(FloatingPointMatrix3x3 const& other) const noexcept;
FloatingPointMatrix3x3 operator-(FloatingPointMatrix3x3 const& other) const noexcept;
FloatingPointMatrix3x3 operator*(FloatingPointMatrix3x3 const& other) const noexcept;
FloatingPointMatrix3x3 operator*(T scaleFactor) const noexcept;
FloatingPointMatrix3x3 operator/(T scaleFactor) const;

bool operator==(FloatingPointMatrix3x3 const& other) const;
bool operator!=(FloatingPointMatrix3x3 const& other) const;
bool operator==(FloatingPointMatrix3x3 const& other) const noexcept;
bool operator!=(FloatingPointMatrix3x3 const& other) const noexcept;

// Function-call operators:
T const& operator()(std::size_t row, std::size_t column) const;
T & operator()(std::size_t row, std::size_t column);

void SetScale(FloatingPointVector3<T> const& scale);
void SetScale(FloatingPointVector3<T> const& scale) noexcept;

FloatingPointVector3<T> GetScale() const;
FloatingPointVector3<T> GetScale() const noexcept;

T Determinant() const;
T Determinant() const noexcept;

FloatingPointMatrix3x3 Concatenate(FloatingPointMatrix3x3 const& other) const;
FloatingPointMatrix3x3 Concatenate(FloatingPointMatrix3x3 const& other) const noexcept;

FloatingPointMatrix3x3 Concatenate(T scaleFactor) const;
FloatingPointMatrix3x3 Concatenate(T scaleFactor) const noexcept;

FloatingPointMatrix2x2<T> Minor2x2(std::size_t row, std::size_t column) const;

static FloatingPointMatrix3x3
Adjoint(FloatingPointMatrix3x3 const& matrix);

static void
Transpose(FloatingPointMatrix3x3 const& matrix, FloatingPointMatrix3x3 & result);
Transpose(FloatingPointMatrix3x3 const& matrix, FloatingPointMatrix3x3 & result) noexcept;

static FloatingPointMatrix3x3
Transpose(FloatingPointMatrix3x3 const& matrix);
Transpose(FloatingPointMatrix3x3 const& matrix) noexcept;

static void
Invert(FloatingPointMatrix3x3 const& matrix, FloatingPointMatrix3x3 & result);
Expand All @@ -88,22 +88,22 @@ class POMDOG_EXPORT FloatingPointMatrix3x3 {
Invert(FloatingPointMatrix3x3 const& matrix);

static void
CreateTranslation(FloatingPointVector2<T> const& position, FloatingPointMatrix3x3 & result);
CreateTranslation(FloatingPointVector2<T> const& position, FloatingPointMatrix3x3 & result) noexcept;

static FloatingPointMatrix3x3
CreateTranslation(FloatingPointVector2<T> const& position);
CreateTranslation(FloatingPointVector2<T> const& position) noexcept;

static void
CreateScale(T scale, FloatingPointMatrix3x3 & result);
CreateScale(T scale, FloatingPointMatrix3x3 & result) noexcept;

static FloatingPointMatrix3x3
CreateScale(T scale);
CreateScale(T scale) noexcept;

static void
CreateScale(FloatingPointVector3<T> const& scale, FloatingPointMatrix3x3 & result);
CreateScale(FloatingPointVector3<T> const& scale, FloatingPointMatrix3x3 & result) noexcept;

static FloatingPointMatrix3x3
CreateScale(FloatingPointVector3<T> const& scale);
CreateScale(FloatingPointVector3<T> const& scale) noexcept;

static void
CreateRotationX(Radian<T> const& angle, FloatingPointMatrix3x3 & result);
Expand Down Expand Up @@ -131,11 +131,11 @@ class POMDOG_EXPORT FloatingPointMatrix3x3 {

static void
CreateLerp(FloatingPointMatrix3x3 const& source1, FloatingPointMatrix3x3 const& source2,
T amount, FloatingPointMatrix3x3 & result);
T amount, FloatingPointMatrix3x3 & result) noexcept;

static FloatingPointMatrix3x3
CreateLerp(FloatingPointMatrix3x3 const& source1, FloatingPointMatrix3x3 const& source2,
T amount);
T amount) noexcept;

static void
CreateFromAxisAngle(FloatingPointVector3<T> const& axis, Radian<T> const& angle, FloatingPointMatrix3x3 & result);
Expand All @@ -154,7 +154,7 @@ class POMDOG_EXPORT FloatingPointMatrix3x3 {

template <typename T>
FloatingPointMatrix3x3<T> POMDOG_EXPORT
operator*(T scaleFactor, FloatingPointMatrix3x3<T> const& matrix);
operator*(T scaleFactor, FloatingPointMatrix3x3<T> const& matrix) noexcept;

} // namespace Detail
} // namespace Pomdog
Loading

0 comments on commit 1ba5c18

Please sign in to comment.