commit 7f65e570b65f24f2e952cfd9d6c2b5d070dd7084 parent 34006cdb904ee50f770f801ae6deb3a243b905d5 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Mar 5 23:11:16 +0200 array::slice const Diffstat:
array.h | | | 6 | ++++++ |
diff --git a/array.h b/array.h @@ -75,6 +75,12 @@ public: return array< T >( elems + start, one_past_end - start ); } + const array< T > slice( size_t start, size_t one_past_end ) const { + 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 );