commit c5e787c1e575530aea9437ea49bf5b128be44f71 parent 565de2b955de43c21200a930e8321997925ad237 Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Jul 1 15:28:53 +0300 Clearer assert in Pool Diffstat:
pool.h | | | 4 | +--- |
diff --git a/pool.h b/pool.h @@ -18,8 +18,7 @@ public: } void release( T * x ) { - ASSERT( ( ( char * ) x - ( char * ) elems.ptr() ) % sizeof( T ) == 0 ); - ASSERT( x - elems.ptr() < ptrdiff_t( N ) ); + ASSERT( x > elems.ptr() && x < elems.ptr() + N ); *x = elems[ elems.n - 1 ]; elems.n--; @@ -29,7 +28,6 @@ public: elems.n = 0; } - T memory[ N ]; array< T > elems; };