]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
Use std::abort() if exceptions are disabled.
authorAlec Thomas <alec@swapoff.org>
Wed, 13 Aug 2014 22:55:51 +0000 (08:55 +1000)
committerAlec Thomas <alec@swapoff.org>
Wed, 13 Aug 2014 22:56:33 +0000 (08:56 +1000)
Fixes #47.

entityx/Entity.h

index c56b37de8268d88f2e306317af37558c18f7bde6..6e5eda7f9da7c3d769693093df4ba659351ff0a7 100644 (file)
@@ -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_;
 };