Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58283 - in sandbox/memory: boost/memory libs/memory/examples/pool
From: xushiweizh_at_[hidden]
Date: 2009-12-10 21:34:55


Author: xushiwei
Date: 2009-12-10 21:34:54 EST (Thu, 10 Dec 2009)
New Revision: 58283
URL: http://svn.boost.org/trac/boost/changeset/58283

Log:
memory/examples/pool;
Text files modified:
   sandbox/memory/boost/memory/object_pool.hpp | 2 +-
   sandbox/memory/boost/memory/pools.hpp | 6 +++---
   sandbox/memory/libs/memory/examples/pool/simple_examples.cpp | 5 +++--
   3 files changed, 7 insertions(+), 6 deletions(-)

Modified: sandbox/memory/boost/memory/object_pool.hpp
==============================================================================
--- sandbox/memory/boost/memory/object_pool.hpp (original)
+++ sandbox/memory/boost/memory/object_pool.hpp 2009-12-10 21:34:54 EST (Thu, 10 Dec 2009)
@@ -178,7 +178,7 @@
         typedef typename PoolT::alloc_type alloc_type;
         typedef typename PoolT::size_type size_type;
 
- using PoolT::element_size;
+ using PoolT::alloc_size;
         using PoolT::get_alloc;
         using PoolT::clear;
         

Modified: sandbox/memory/boost/memory/pools.hpp
==============================================================================
--- sandbox/memory/boost/memory/pools.hpp (original)
+++ sandbox/memory/boost/memory/pools.hpp 2009-12-10 21:34:54 EST (Thu, 10 Dec 2009)
@@ -36,7 +36,7 @@
 #pragma warning(disable:4035)
 #pragma warning(disable:4793)
 
-__forceinline unsigned int log2(IN unsigned int val) {
+__forceinline unsigned int log2(unsigned int val) {
         BOOST_MEMORY_ASSERT(val != 0);
         __asm {
                 bsr eax, val
@@ -49,7 +49,7 @@
 
 #elif defined(__GNUG__) || defined(__GNUC__) // g++/gcc
 
-__forceinline unsigned int log2(IN unsigned int val)
+__forceinline unsigned int log2(unsigned int val)
 {
         BOOST_MEMORY_ASSERT(val != 0);
         unsigned int result;
@@ -60,7 +60,7 @@
 
 #else
 
-__forceinline unsigned int log2(IN unsigned int val)
+__forceinline unsigned int log2(unsigned int val)
 {
         BOOST_MEMORY_ASSERT(val != 0);
 

Modified: sandbox/memory/libs/memory/examples/pool/simple_examples.cpp
==============================================================================
--- sandbox/memory/libs/memory/examples/pool/simple_examples.cpp (original)
+++ sandbox/memory/libs/memory/examples/pool/simple_examples.cpp 2009-12-10 21:34:54 EST (Thu, 10 Dec 2009)
@@ -10,6 +10,7 @@
 // See http://www.boost.org/libs/memory/index.htm for documentation.
 //
 #include <boost/memory.hpp>
+#include <boost/memory/object_pool.hpp>
 
 // -------------------------------------------------------------------------
 
@@ -122,9 +123,9 @@
 
         void* p[22];
         for (i = 0; i < countof(p); ++i)
- p[i] = alloc.allocate(i * 7);
+ p[i] = alloc.get_pool(i * 7).allocate();
         for (i = 3; i < countof(p) - 2; ++i)
- alloc.deallocate(p[i], i * 7);
+ alloc.get_pool(i * 7).deallocate(p[i]);
 }
 
 int main()


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