|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53953 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-15 21:12:47
Author: cschladetsch
Date: 2009-06-15 21:12:47 EDT (Mon, 15 Jun 2009)
New Revision: 53953
URL: http://svn.boost.org/trac/boost/changeset/53953
Log:
fixes for GCC
Text files modified:
sandbox/monotonic/boost/monotonic/chained_storage.h | 17 ++++++++---------
sandbox/monotonic/libs/monotonic/test/test_map_list.cpp | 11 +++++++++++
2 files changed, 19 insertions(+), 9 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/chained_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/chained_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/chained_storage.h 2009-06-15 21:12:47 EDT (Mon, 15 Jun 2009)
@@ -1,6 +1,6 @@
// Copyright (C) 2009 Christian Schladetsch
//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
@@ -15,21 +15,20 @@
///
/// allocation requests first use inline storage of N bytes.
/// once that is exhausted, later requests are serviced from the heap.
- ///
+ ///
/// all allocations remain valid at all times.
- template <size_t N, size_t MLS = N*2, class Al = std::allocator<char> >
+ template <size_t N, size_t MinLinkSize = N*2, class Al = std::allocator<char> >
struct chained_storage : storage_base
{
- BOOST_STATIC_CONSTANT(size_t, MinLinkSize = MLS);
typedef Al Allocator;
- typedef typename Allocator::rebind<char>::other CharAllocator;
+ typedef typename Allocator::template rebind<char>::other CharAllocator;
struct Link
{
size_t capacity, cursor;
char *buffer;
CharAllocator alloc;
- Link(Allocator const &al, size_t N)
- : capacity(N), cursor(0), buffer(0), alloc(al)
+ Link(Allocator const &al, size_t cap)
+ : capacity(cap), cursor(0), buffer(0), alloc(al)
{
}
void Construct()
@@ -69,10 +68,10 @@
Allocator alloc; // allocator for heap-based storage
public:
- chained_storage()
+ chained_storage()
{
}
- chained_storage(Allocator const &A)
+ chained_storage(Allocator const &A)
: alloc(A)
{
}
Modified: sandbox/monotonic/libs/monotonic/test/test_map_list.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/test_map_list.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/test_map_list.cpp 2009-06-15 21:12:47 EDT (Mon, 15 Jun 2009)
@@ -52,10 +52,21 @@
monotonic::storage<1000000> storage;
typedef std::map<size_t, pair<double, double> > Results;
Results results;
+
+ // do a test with a large dataset on the heap
+ {
+ const size_t buffer_size = 10*1000*1000;
+ monotonic::storage<buffer_size> *storage = new monotonic::storage<buffer_size>;
+ size_t num_loops = 100*1000;
+ results[num_loops] = test_map_list(outter_loops, num_loops, *storage);
+ delete storage;
+ }
+
for (size_t inner = 100; inner < inner_loops; inner += 1000)
{
results[inner] = test_map_list(outter_loops, inner, storage);
}
+
cout << "test_map_list" << endl;
BOOST_FOREACH(Results::value_type const &result, results)
{
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