40 volatile unsigned int c;
42 std::atomic<unsigned int> c;
47 void increase() { ++c; }
48 unsigned int decrease() {
return --c; }
60 const unsigned int x, y;
63 matrix(
unsigned int x,
unsigned int y) :
73 y(p.y) { count->increase(); }
75 ~matrix() {
if (count->decrease() == 0) {
delete count;
delete [] data; } }
77 unsigned int length()
const {
return x * y; }
79 T* operator[](
unsigned int a) {
return &data[a * y]; }
81 T
const* operator[](
unsigned int a)
const {
return &data[a * y]; }