medfall

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

commit 05c116b60f9b1f26fcb7e234f804d2022a4f1d7d
parent 69773421b1cd453d0df49dd451af871b3e618118
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Nov 22 22:02:57 +0200

Add StaticArray

Diffstat:
array.h | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/array.h b/array.h @@ -52,7 +52,7 @@ public: size_t n; -private: +protected: T * elems; }; @@ -94,4 +94,16 @@ private: T * elems; }; +template< typename T, size_t N > +class StaticArray : public array< T > { +public: + StaticArray() : array< T >() { + array< T >::elems = elems_memory; + array< T >::n = N; + } + +private: + T elems_memory[ N ]; +}; + #endif // _ARRAY_H_