medfall

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

commit 34006cdb904ee50f770f801ae6deb3a243b905d5
parent 122e6709151190e29b101180d3bf2db5f5c1ac10
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Mar  5 23:10:51 +0200

array::slice

Diffstat:
array.h | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/array.h b/array.h @@ -69,6 +69,12 @@ public: return elems + n; } + array< T > slice( size_t start, size_t one_past_end ) { + ASSERT( start <= one_past_end ); + ASSERT( one_past_end <= n ); + return array< T >( elems + start, one_past_end - start ); + } + template< typename S > array< S > cast() { ASSERT( num_bytes() % sizeof( S ) == 0 );