From f60135cec62c91a9d7923397fe8796d2b3eaa5cb Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 12 Sep 2018 16:27:42 -0400 Subject: Feature/memory arena (#631) * First pass at MemoryArena. * First pass at RandomGenerator. * Extract TestContext into external source file. * Fix warning on printf. * Use enum classes for Test enums. OutputMode -> TestOutputMode. * First pass at FreeList unit test. * Auto registering tests. Improvements to RandomGenerator. * Remove the need for unitTest headers - cos can use registering. * Added unitTest for MemoryArena. * Do unit tests. * Fix typo. --- source/core/list.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/core/list.h') diff --git a/source/core/list.h b/source/core/list.h index 6df60b74b..cddcbb6c0 100644 --- a/source/core/list.h +++ b/source/core/list.h @@ -199,6 +199,15 @@ namespace Slang return buffer[_count-1]; } + void RemoveLast() + { +#ifdef _DEBUG + if (_count == 0) + throw "Index out of range."; +#endif + _count--; + } + inline void SwapWith(List & other) { T* tmpBuffer = this->buffer; -- cgit v1.2.3