aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/string.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/string.ixx
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'libxsde/xsde/cxx/string.ixx')
-rw-r--r--libxsde/xsde/cxx/string.ixx14
1 files changed, 14 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/string.ixx b/libxsde/xsde/cxx/string.ixx
index ce479bb..f8f8378 100644
--- a/libxsde/xsde/cxx/string.ixx
+++ b/libxsde/xsde/cxx/string.ixx
@@ -5,6 +5,12 @@
#include <string.h>
+#include <xsde/cxx/config.hxx>
+
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -12,7 +18,11 @@ namespace xsde
inline string::
~string ()
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
delete[] data_;
+#else
+ cxx::free (data_);
+#endif
}
inline string::
@@ -40,7 +50,11 @@ namespace xsde
inline void string::
attach (char* s, size_t n)
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
delete[] data_;
+#else
+ cxx::free (data_);
+#endif
data_ = s;
size_ = n;