5 #pragma warning(disable: 4018)
37 assert(width > 0 && height > 0);
41 _data = std::shared_ptr<T>(
new T[size], std::default_delete<T[]>());
42 for (
u32_t i = 0; i < size; i++) {
56 assert(vec.
x < _width && vec.
y < _height);
58 const u32_t index = vec.
x * _height + vec.
y;
59 assert(index < (_width * _height));
61 return _data.get()[index];
65 assert(vec.
x < _width && vec.
y < _height);
67 const u32_t index = vec.
x * _height + vec.
y;
68 assert(index < (_width * _height));
70 return _data.get()[index];
82 return &_data.get()[0];
86 return &_data.get()[_width *
_height];
92 for (
u32_t i = 0, x = 1; i < size; i++, x++) {
93 out << m.
_data.get()[i] <<
',';
u16_t height() const
Definition: matrix.hpp:51
unsigned short int u16_t
Definition: types.hpp:6
const T & operator()(u16_t x, u16_t y) const
Definition: matrix.hpp:77
unsigned long int u32_t
Definition: types.hpp:8
T x
Definition: point.hpp:16
u16_t width() const
Definition: matrix.hpp:47
u16_t _width
Definition: matrix.hpp:24
u16_t _height
Definition: matrix.hpp:25
T & operator()(u16_t x, u16_t y)
Definition: matrix.hpp:73
friend std::ostream & operator<<(std::ostream &out, Matrix &m)
Definition: matrix.hpp:89
T & operator[](const Point< u16_t, u16_t > &vec)
Definition: matrix.hpp:55
T * end()
Definition: matrix.hpp:85
Definition: matrix.hpp:22
T * begin()
Definition: matrix.hpp:81
U y
Definition: point.hpp:21
std::shared_ptr< T > _data
Definition: matrix.hpp:27
Matrix(u16_t width, u16_t height, const T &def=T())
Definition: matrix.hpp:36
Definition: algorithms.cpp:8