|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53225 - in sandbox/memory: boost/memory libs/memory/examples/pool libs/memory/examples/stl_containers
From: xushiweizh_at_[hidden]
Date: 2009-05-23 23:06:43
Author: xushiwei
Date: 2009-05-23 23:06:42 EDT (Sat, 23 May 2009)
New Revision: 53225
URL: http://svn.boost.org/trac/boost/changeset/53225
Log:
class pools, scoped_pools
Text files modified:
sandbox/memory/boost/memory/pool.hpp | 10 ++++++++++
sandbox/memory/libs/memory/examples/pool/simple_examples.cpp | 3 +--
sandbox/memory/libs/memory/examples/stl_containers/stl_containers.cpp | 9 +++------
3 files changed, 14 insertions(+), 8 deletions(-)
Modified: sandbox/memory/boost/memory/pool.hpp
==============================================================================
--- sandbox/memory/boost/memory/pool.hpp (original)
+++ sandbox/memory/boost/memory/pool.hpp 2009-05-23 23:06:42 EDT (Sat, 23 May 2009)
@@ -16,6 +16,10 @@
#include "fixed_alloc.hpp"
#endif
+#ifndef BOOST_MEMORY_POOLS_ALLOC_HPP
+#include "pools_alloc.hpp"
+#endif
+
#ifndef BOOST_MEMORY_BLOCKPOOL_HPP
#include "block_pool.hpp"
#endif
@@ -29,6 +33,12 @@
typedef fixed_alloc<NS_BOOST_MEMORY_POLICY::scoped> scoped_pool;
// -------------------------------------------------------------------------
+// class pools, scoped_pools
+
+typedef pools_alloc<NS_BOOST_MEMORY_POLICY::stdlib> pools;
+typedef pools_alloc<NS_BOOST_MEMORY_POLICY::scoped> scoped_pools;
+
+// -------------------------------------------------------------------------
// $Log: $
NS_BOOST_MEMORY_END
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-05-23 23:06:42 EDT (Sat, 23 May 2009)
@@ -10,7 +10,6 @@
// See http://www.boost.org/libs/memory/index.htm for documentation.
//
#include <boost/memory.hpp>
-#include <boost/memory/pools_alloc.hpp>
// -------------------------------------------------------------------------
@@ -119,7 +118,7 @@
{
size_t i;
boost::memory::block_pool recycle;
- boost::memory::pools_alloc<boost::memory::policy::scoped> alloc(recycle);
+ boost::memory::scoped_pools alloc(recycle);
void* p[22];
for (i = 0; i < countof(p); ++i)
Modified: sandbox/memory/libs/memory/examples/stl_containers/stl_containers.cpp
==============================================================================
--- sandbox/memory/libs/memory/examples/stl_containers/stl_containers.cpp (original)
+++ sandbox/memory/libs/memory/examples/stl_containers/stl_containers.cpp 2009-05-23 23:06:42 EDT (Sat, 23 May 2009)
@@ -17,7 +17,6 @@
#include <cstdio>
#include <boost/memory.hpp>
-#include <boost/memory/pools_alloc.hpp>
using NS_BOOST_MEMORY::stl_allocator;
@@ -67,13 +66,11 @@
void testPoolsAllocSet()
{
- typedef NS_BOOST_MEMORY::block_pool block_pool;
- typedef NS_BOOST_MEMORY::pools_alloc<NS_BOOST_MEMORY_POLICY::scoped> scoped_pools;
- typedef NS_BOOST_MEMORY::stl_allocator<int, scoped_pools> allocator;
+ typedef NS_BOOST_MEMORY::stl_allocator<int, NS_BOOST_MEMORY::scoped_pools> allocator;
printf("\n===== Set (pools_alloc) =====\n");
- block_pool recycle;
- scoped_pools alloc(recycle);
+ NS_BOOST_MEMORY::block_pool recycle;
+ NS_BOOST_MEMORY::scoped_pools alloc(recycle);
std::set<int, std::less<int>, allocator> s(std::less<int>(), alloc);
for (int i = 0; i < Count; ++i)
s.insert(i);
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