add function to return bytes needed for matrix

This commit is contained in:
Max Lübke 2023-10-02 13:19:06 +02:00
parent 8bc248c8e5
commit 93257b1efc

View File

@ -1,6 +1,7 @@
#ifndef MATRIX_H_ #ifndef MATRIX_H_
#define MATRIX_H_ #define MATRIX_H_
#include <cstddef>
#include <cstdint> #include <cstdint>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
@ -68,6 +69,8 @@ template <class T> struct Matrix {
constexpr XXH32_hash_t HASH_SEED = 42; constexpr XXH32_hash_t HASH_SEED = 42;
return XXH32(this->data.data(), mem.size(), HASH_SEED); return XXH32(this->data.data(), mem.size(), HASH_SEED);
} }
std::size_t bytes() const { return this->mem.size() * sizeof(T); }
}; };
template <class T> std::ostream &operator<<(std::ostream &os, Matrix<T> &mat) { template <class T> std::ostream &operator<<(std::ostream &os, Matrix<T> &mat) {