From 729e8dfff5d888d85c8d8c4201fa956378f4b917 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Tue, 13 Jan 2009 21:55:35 +0000 Subject: Revise allocator per patch in QPID-1458; Fixes QPID-1458 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@734251 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/InlineAllocator.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/InlineAllocator.h b/cpp/src/qpid/InlineAllocator.h index bf2f570599..152c02a299 100644 --- a/cpp/src/qpid/InlineAllocator.h +++ b/cpp/src/qpid/InlineAllocator.h @@ -29,6 +29,10 @@ namespace qpid { +template +struct InlineRebind; + + /** * An allocator that has inline storage for up to Max objects * of type BaseAllocator::value_type. @@ -63,8 +67,7 @@ class InlineAllocator : public BaseAllocator { template struct rebind { - typedef typename BaseAllocator::template rebind::other BaseOther; - typedef InlineAllocator other; + typedef typename InlineRebind::other other; }; private: @@ -79,6 +82,20 @@ class InlineAllocator : public BaseAllocator { bool allocated; }; + +// Rebind: if RequestedType == InlineType, use the InlineAllocator, +// otherwise, use the BaseAllocator without any inlining. + +template +struct InlineRebind { + typedef typename BaseAllocator::template rebind::other other; +}; + +template +struct InlineRebind { + typedef typename qpid::InlineAllocator other; +}; + } // namespace qpid #endif /*!QPID_INLINEALLOCATOR_H*/ -- cgit v1.2.1