medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1285f0e12bd339c487e45c6f37f1ab1361742195
parent 6f674784ee79dd49d935ff6532d859092eb95a52
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Nov 13 22:13:19 +0200

Make array2d copyable

Diffstat:
array.h | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/array.h b/array.h @@ -59,8 +59,10 @@ private: template< typename T > class array2d { public: - array2d( T * memory, size_t width, size_t height ) : w( width ), h( height ), bytes( sizeof( T ) * width * height ) { + array2d( T * memory, size_t width, size_t height ) { ASSERT( memory != NULL ); + w = width; + h = height; elems = memory; } @@ -82,8 +84,11 @@ public: return elems; } - const size_t w, h; - const size_t bytes; + size_t bytes() const { + return sizeof( T ) * w * h; + } + + size_t w, h; private: T * elems;