|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52797 - sandbox/memory/boost/memory
From: xushiweizh_at_[hidden]
Date: 2009-05-06 04:01:19
Author: xushiwei
Date: 2009-05-06 04:01:17 EDT (Wed, 06 May 2009)
New Revision: 52797
URL: http://svn.boost.org/trac/boost/changeset/52797
Log:
bug fix: array_factory_has_destructor
Text files modified:
sandbox/memory/boost/memory/type_traits.hpp | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
Modified: sandbox/memory/boost/memory/type_traits.hpp
==============================================================================
--- sandbox/memory/boost/memory/type_traits.hpp (original)
+++ sandbox/memory/boost/memory/type_traits.hpp 2009-05-06 04:01:17 EDT (Wed, 06 May 2009)
@@ -106,6 +106,8 @@
// =========================================================================
// class array_factory
+#pragma pack(1)
+
template <class Type>
struct array_factory_has_destructor
{
@@ -131,7 +133,7 @@
destructor_header* hdr =
(destructor_header*)alloc.allocate(
sizeof(destructor_header) + sizeof(Type)*count, destruct);
- Type* array = (Type*)hdr + 1;
+ Type* array = (Type*)(hdr + 1);
hdr->count = count;
constructor_traits<Type>::constructArray(array, count);
return array;
@@ -143,10 +145,11 @@
destructor_header* hdr =
(destructor_header*)alloc.unmanaged_alloc(
sizeof(destructor_header) + sizeof(Type)*count, destruct);
- Type* array = (Type*)hdr + 1;
+ Type* array = (Type*)(hdr + 1);
hdr->count = count;
constructor_traits<Type>::constructArray(array, count);
- return (Type*)alloc.manage(array, destruct);
+ alloc.manage(hdr, destruct);
+ return array;
}
#endif
@@ -161,6 +164,8 @@
}
};
+#pragma pack()
+
template <class Type>
struct array_factory_no_destructor
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk