Skip to content

Commit

Permalink
- Add free spacing() function for blast::DynamicMatrix
Browse files Browse the repository at this point in the history
- Add IsStatic specialization for const types
  • Loading branch information
Mikhail Katliar authored and mkatliar committed Sep 20, 2024
1 parent 5317d42 commit 36c5b7c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/blast/math/dense/DynamicMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ namespace blast
class DynamicMatrix
{
public:
using ElementType = T;


explicit DynamicMatrix(size_t m, size_t n)
: m_ {m}
, n_ {n}
Expand Down Expand Up @@ -153,6 +156,13 @@ namespace blast
}


template <typename T, bool SO>
inline size_t constexpr spacing(DynamicMatrix<T, SO> const& m) noexcept
{
return m.spacing();
}


template <typename T, bool SO>
inline constexpr T * data(DynamicMatrix<T, SO>& m) noexcept
{
Expand Down
9 changes: 9 additions & 0 deletions include/blast/math/typetraits/IsStatic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ namespace blast
struct IsStatic;


/**
* @brief Specialization for const types
*
* @tparam T matrix or vector type
*/
template <typename T>
struct IsStatic<T const> : IsStatic<T> {};


/**
* @brief Shortcut for @a IsStatic<T>::value
*
Expand Down

0 comments on commit 36c5b7c

Please sign in to comment.