aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/stack.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
commit2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch)
tree49c2748443fe3c1f01108756b647440e0647a11b /libxsde/xsde/cxx/stack.ixx
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'libxsde/xsde/cxx/stack.ixx')
-rw-r--r--libxsde/xsde/cxx/stack.ixx13
1 files changed, 12 insertions, 1 deletions
diff --git a/libxsde/xsde/cxx/stack.ixx b/libxsde/xsde/cxx/stack.ixx
index 05c60ac..8b69407 100644
--- a/libxsde/xsde/cxx/stack.ixx
+++ b/libxsde/xsde/cxx/stack.ixx
@@ -3,6 +3,12 @@
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#else
+# include <new> // operator new/delete
+#endif
+
namespace xsde
{
namespace cxx
@@ -10,7 +16,12 @@ namespace xsde
inline stack::
~stack ()
{
- delete[] data_;
+ if (data_)
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ operator delete (data_);
+#else
+ cxx::free (data_);
+#endif
}
inline stack::