data function for vector and matrix

This commit is contained in:
BlackMATov
2020-12-03 06:34:28 +07:00
parent 6513122fc5
commit 76174171f3
5 changed files with 69 additions and 1 deletions

View File

@@ -204,10 +204,18 @@ namespace vmath_hpp
void swap(mat& other) noexcept(std::is_nothrow_swappable_v<T>) {
for ( std::size_t i = 0; i < Size; ++i ) {
using std::swap;
swap((*this)[i], other[i]);
swap(rows[i], other.rows[i]);
}
}
[[nodiscard]] constexpr pointer data() noexcept {
return &rows[0];
}
[[nodiscard]] constexpr const_pointer data() const noexcept {
return &rows[0];
}
[[nodiscard]] constexpr reference operator[](std::size_t index) noexcept {
return rows[index];
}