medfall

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

commit 53bda8c14e568e2dc00ef622cb9541de65d55a41
parent 7b40c4733d292269f4bae6a29051c15f2d48e56f
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Dec 15 21:13:52 +0200

Make array::operator+ behave more like pointer addition

Diffstat:
array.h | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/array.h b/array.h @@ -50,14 +50,14 @@ public: return elems[ i ]; } - T * operator+( size_t i ) { + array< T > operator+( size_t i ) { ASSERT( i < n ); - return &elems[ i ]; + return array< T >( elems + i, n - i ); } - const T * operator+( size_t i ) const { + const array< T > operator+( size_t i ) const { ASSERT( i < n ); - return &elems[ i ]; + return array< T >( elems + i, n - i ); } bool in_range( size_t i ) const {