diff --git a/include/blt/std/memory.h b/include/blt/std/memory.h index 173c8fd..37a6365 100755 --- a/include/blt/std/memory.h +++ b/include/blt/std/memory.h @@ -11,6 +11,7 @@ #include #include #include "queue.h" +#include #include #include #include @@ -179,7 +180,11 @@ namespace blt explicit scoped_buffer(size_t size): _size(size) { - _buffer = new T[size]; + BLT_ASSERT(size >= 0); + if (size > 0) + _buffer = new T[size]; + else + _buffer = nullptr; } scoped_buffer(const scoped_buffer& copy)