Skip to content

Commit

Permalink
MatrixTile: shared_ptr<T> -> shared_ptr<T[]>
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Oct 31, 2023
1 parent 26da9b4 commit 3fe4a06
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/matrixtile.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
template <typename T>
class MatrixTile {
public:
using metadata_t = typename std::tuple<int, int, int>;
using metadata_t = std::tuple<int, int, int>;

using pointer_t = typename std::shared_ptr<T>;
using pointer_t = std::shared_ptr<T[]>;

private:
pointer_t _data;
int _rows = 0, _cols = 0, _lda = 0;

// (Re)allocate the tile memory
void realloc() {
// std::cout << "Reallocating new tile" << std::endl;
_data = std::shared_ptr<T>(new T[_lda * _cols], [](T* p) { delete[] p; });
_data = std::shared_ptr<T[]>(new T[_lda * _cols]);
}

public:
Expand Down

0 comments on commit 3fe4a06

Please sign in to comment.