diff options
author | Alec Thomas <alec@swapoff.org> | 2014-08-14 08:55:51 +1000 |
---|---|---|
committer | Alec Thomas <alec@swapoff.org> | 2014-08-14 08:56:33 +1000 |
commit | 0db983990d66132bd8a0cef594de9c1db9ebe0a4 (patch) | |
tree | c77158a32b9fb46d2a38356a51914d2e9f0a88f7 | |
parent | 17b51d775875c9eea7313d70764623250c941870 (diff) |
Use std::abort() if exceptions are disabled.
Fixes #47.
-rw-r--r-- | entityx/Entity.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/entityx/Entity.h b/entityx/Entity.h index c56b37d..6e5eda7 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -220,24 +220,19 @@ struct BaseComponent { // NOTE: Component memory is *always* managed by the EntityManager. // Use Entity::destroy() instead. - void operator delete(void *p) { -#ifdef _HAS_EXCEPTIONS - throw std::bad_alloc(); -#else - abort(); -#endif - } + void operator delete(void *p) { fail(); } + void operator delete[](void *p) { fail(); } + - void operator delete[](void *p) { -#ifdef _HAS_EXCEPTIONS + protected: + void fail() { +#if defined(_HAS_EXCEPTIONS) || defined(__EXCEPTIONS) throw std::bad_alloc(); #else - abort(); + std::abort(); #endif - } - - protected: + } static Family family_counter_; }; |