Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52533 - sandbox/memory/boost/memory
From: xushiweizh_at_[hidden]
Date: 2009-04-22 01:35:40


Author: xushiwei
Date: 2009-04-22 01:35:38 EDT (Wed, 22 Apr 2009)
New Revision: 52533
URL: http://svn.boost.org/trac/boost/changeset/52533

Log:
1. auto_alloc.hpp = region_alloc.hpp + system_alloc.hpp
2. scoped_alloc.hpp = system_alloc.hpp + block_pool.hpp

Text files modified:
   sandbox/memory/boost/memory/auto_alloc.hpp | 87 +++++++++++++++++++++++++++++++++++++
   sandbox/memory/boost/memory/block_pool.hpp | 4
   sandbox/memory/boost/memory/region_alloc.hpp | 91 ---------------------------------------
   sandbox/memory/boost/memory/scoped_alloc.hpp | 15 +++++
   4 files changed, 102 insertions(+), 95 deletions(-)

Modified: sandbox/memory/boost/memory/auto_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/auto_alloc.hpp (original)
+++ sandbox/memory/boost/memory/auto_alloc.hpp 2009-04-22 01:35:38 EDT (Wed, 22 Apr 2009)
@@ -12,13 +12,96 @@
 #ifndef BOOST_MEMORY_AUTO_ALLOC_HPP
 #define BOOST_MEMORY_AUTO_ALLOC_HPP
 
-// -------------------------------------------------------------------------
-
 #ifndef BOOST_MEMORY_REGION_ALLOC_HPP
 #include "region_alloc.hpp"
 #endif
 
+#ifndef BOOST_MEMORY_SYSTEM_ALLOC_HPP
+#include "system_alloc.hpp"
+#endif
+
+NS_BOOST_MEMORY_BEGIN
+
+// -------------------------------------------------------------------------
+// class auto_alloc
+
+#if defined(_MSC_VER) && (_MSC_VER <= 1200) // VC++ 6.0
+
+class auto_alloc : public region_alloc<NS_BOOST_MEMORY_POLICY::stdlib>
+{
+private:
+ typedef region_alloc<NS_BOOST_MEMORY_POLICY::stdlib> BaseClass;
+
+public:
+ auto_alloc() {}
+ explicit auto_alloc(auto_alloc&) {}
+
+ __forceinline void BOOST_MEMORY_CALL swap(auto_alloc& o) {
+ BaseClass::swap(o);
+ }
+
+ __forceinline void BOOST_MEMORY_CALL clear() {
+ BaseClass::clear();
+ }
+
+ __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb) {
+ return BaseClass::allocate(cb);
+ }
+
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
+ __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero) {
+ return BaseClass::allocate(cb);
+ }
+
+ __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn) {
+ return BaseClass::allocate(cb, fn);
+ }
+#endif
+
+ __forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, destructor_t fn) {
+ return BaseClass::unmanaged_alloc(cb, fn);
+ }
+
+ __forceinline void BOOST_MEMORY_CALL manage(void* p, destructor_t fn) {
+ BaseClass::manage(p, fn);
+ }
+
+ __forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero) {
+ return BaseClass::allocate(cb);
+ }
+
+ __forceinline void BOOST_MEMORY_CALL manage(void* p, int fnZero) {
+ // no action
+ }
+
+ void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize) {
+ return BaseClass::reallocate(p, oldSize, newSize);
+ }
+
+ void BOOST_MEMORY_CALL deallocate(void* p, size_t cb) {
+ // no action
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroy(Type* obj) {
+ // no action
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count) {
+ // no action
+ }
+};
+
+#else
+
+typedef region_alloc<NS_BOOST_MEMORY_POLICY::stdlib> auto_alloc;
+
+#endif
+
 // -------------------------------------------------------------------------
 // $Log: auto_alloc.hpp,v $
 
+NS_BOOST_MEMORY_END
+
 #endif /* BOOST_MEMORY_AUTO_ALLOC_HPP */

Modified: sandbox/memory/boost/memory/block_pool.hpp
==============================================================================
--- sandbox/memory/boost/memory/block_pool.hpp (original)
+++ sandbox/memory/boost/memory/block_pool.hpp 2009-04-22 01:35:38 EDT (Wed, 22 Apr 2009)
@@ -12,8 +12,8 @@
 #ifndef BOOST_MEMORY_BLOCKPOOL_HPP
 #define BOOST_MEMORY_BLOCKPOOL_HPP
 
-#ifndef BOOST_MEMORY_BASIC_HPP
-#include "basic.hpp"
+#ifndef BOOST_MEMORY_SYSTEM_ALLOC_HPP
+#include "system_alloc.hpp"
 #endif
 
 #ifndef BOOST_MEMORY_THREAD_TLS_HPP

Modified: sandbox/memory/boost/memory/region_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/region_alloc.hpp (original)
+++ sandbox/memory/boost/memory/region_alloc.hpp 2009-04-22 01:35:38 EDT (Wed, 22 Apr 2009)
@@ -12,12 +12,8 @@
 #ifndef BOOST_MEMORY_REGION_ALLOC_HPP
 #define BOOST_MEMORY_REGION_ALLOC_HPP
 
-#ifndef BOOST_MEMORY_SYSTEM_ALLOC_HPP
-#include "system_alloc.hpp"
-#endif
-
-#ifndef BOOST_MEMORY_BLOCKPOOL_HPP
-#include "block_pool.hpp"
+#ifndef BOOST_MEMORY_BASIC_HPP
+#include "basic.hpp"
 #endif
 
 #if !defined(_GLIBCXX_ALGORITHM) && !defined(_ALGORITHM)
@@ -37,7 +33,6 @@
 
 public:
         enum { MemBlockSize = PolicyT::MemBlockBytes - AllocT::Padding };
- enum { IsGCAllocator = 1 };
 
         typedef AllocT alloc_type;
 
@@ -238,88 +233,6 @@
 };
 
 // -------------------------------------------------------------------------
-// class auto_alloc
-
-#if defined(_MSC_VER) && (_MSC_VER <= 1200) // VC++ 6.0
-
-class auto_alloc : public region_alloc<NS_BOOST_MEMORY_POLICY::stdlib>
-{
-private:
- typedef region_alloc<NS_BOOST_MEMORY_POLICY::stdlib> BaseClass;
-
-public:
- auto_alloc() {}
- explicit auto_alloc(auto_alloc&) {}
-
- __forceinline void BOOST_MEMORY_CALL swap(auto_alloc& o) {
- BaseClass::swap(o);
- }
-
- __forceinline void BOOST_MEMORY_CALL clear() {
- BaseClass::clear();
- }
-
- __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb) {
- return BaseClass::allocate(cb);
- }
-
-#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
- __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero) {
- return BaseClass::allocate(cb);
- }
-
- __forceinline void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn) {
- return BaseClass::allocate(cb, fn);
- }
-#endif
-
- __forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, destructor_t fn) {
- return BaseClass::unmanaged_alloc(cb, fn);
- }
-
- __forceinline void BOOST_MEMORY_CALL manage(void* p, destructor_t fn) {
- BaseClass::manage(p, fn);
- }
-
- __forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero) {
- return BaseClass::allocate(cb);
- }
-
- __forceinline void BOOST_MEMORY_CALL manage(void* p, int fnZero) {
- // no action
- }
-
- void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize) {
- return BaseClass::reallocate(p, oldSize, newSize);
- }
-
- void BOOST_MEMORY_CALL deallocate(void* p, size_t cb) {
- // no action
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL destroy(Type* obj) {
- // no action
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count) {
- // no action
- }
-};
-
-#else
-
-typedef region_alloc<NS_BOOST_MEMORY_POLICY::stdlib> auto_alloc;
-
-#endif
-
-// -------------------------------------------------------------------------
-// class scoped_alloc
-
-typedef region_alloc<NS_BOOST_MEMORY_POLICY::pool> scoped_alloc;
-
-// -------------------------------------------------------------------------
 // $Log: region_alloc.hpp,v $
 
 NS_BOOST_MEMORY_END

Modified: sandbox/memory/boost/memory/scoped_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/scoped_alloc.hpp (original)
+++ sandbox/memory/boost/memory/scoped_alloc.hpp 2009-04-22 01:35:38 EDT (Wed, 22 Apr 2009)
@@ -12,13 +12,24 @@
 #ifndef BOOST_MEMORY_SCOPED_ALLOC_HPP
 #define BOOST_MEMORY_SCOPED_ALLOC_HPP
 
-// -------------------------------------------------------------------------
-
 #ifndef BOOST_MEMORY_REGION_ALLOC_HPP
 #include "region_alloc.hpp"
 #endif
 
+#ifndef BOOST_MEMORY_BLOCKPOOL_HPP
+#include "block_pool.hpp"
+#endif
+
+NS_BOOST_MEMORY_BEGIN
+
+// -------------------------------------------------------------------------
+// class scoped_alloc
+
+typedef region_alloc<NS_BOOST_MEMORY_POLICY::pool> scoped_alloc;
+
 // -------------------------------------------------------------------------
 // $Log: scoped_alloc.hpp,v $
 
+NS_BOOST_MEMORY_END
+
 #endif /* BOOST_MEMORY_SCOPED_ALLOC_HPP */


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