|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53920 - in sandbox/monotonic: boost/monotonic boost/utility libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-15 02:28:15
Author: cschladetsch
Date: 2009-06-15 02:28:15 EDT (Mon, 15 Jun 2009)
New Revision: 53920
URL: http://svn.boost.org/trac/boost/changeset/53920
Log:
fixes for GCC
Text files modified:
sandbox/monotonic/boost/monotonic/rope.h | 23 ++++++++++++-----------
sandbox/monotonic/boost/utility/iter_range.h | 34 ++++++++++++++++++++--------------
sandbox/monotonic/libs/monotonic/test/main.cpp | 12 +++++++-----
3 files changed, 39 insertions(+), 30 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/rope.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/rope.h (original)
+++ sandbox/monotonic/boost/monotonic/rope.h 2009-06-15 02:28:15 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
@@ -10,6 +10,7 @@
#include <boost/utility/iter_range.h>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_categories.hpp>
+#include <boost/foreach.hpp>
namespace boost
{
@@ -56,11 +57,11 @@
VectorIterators vec;
iterator_base() { }
- iterator_base(Rope &P)
+ iterator_base(Rope &P)
: parent(&P) { }
iterator_base(Rope &P, StrandIterators const &S)
: parent(&P), strand(S) { }
- iterator_base(Rope &P, StrandIterators const &S, VectorIterators const &V)
+ iterator_base(Rope &P, StrandIterators const &S, VectorIterators const &V)
: parent(&P), strand(S), vec(V) { }
Derived &This()
{
@@ -97,11 +98,11 @@
{
typedef iterator_base<Rope, StrandsIterators, VectorIterators, iterator> Parent;
iterator() { }
- iterator(Rope &P)
+ iterator(Rope &P)
: Parent(P) { }
iterator(Rope &P, StrandsIterators const &S)
: Parent(P, S) { }
- iterator(Rope &P, StrandsIterators const &S, VectorIterators const &V)
+ iterator(Rope &P, StrandsIterators const &S, VectorIterators const &V)
: Parent(P, S, V) { }
T const &operator*() const
{
@@ -117,14 +118,14 @@
{
typedef iterator_base<Rope const, ConstStrandsIterators, ConstVectorIterators, const_iterator> Parent;
const_iterator() { }
- const_iterator(Rope const &P)
+ const_iterator(Rope const &P)
: Parent(P) { }
const_iterator(Iter const &X)
- : Parent(*X.parent, X.strand, X.vec)
+ : Parent(*X.parent, X.strand, X.vec)
{ }
const_iterator(Rope const &P, ConstStrandsIterators const &S)
: Parent(P, S) { }
- const_iterator(Rope const &P, ConstStrandsIterators const &S, ConstVectorIterators const &V)
+ const_iterator(Rope const &P, ConstStrandsIterators const &S, ConstVectorIterators const &V)
: Parent(P, S, V) { }
T const &operator*() const
{
@@ -133,12 +134,12 @@
};
private:
- Strands strands;
Allocator alloc;
+ Strands strands;
public:
chain() { }
- chain(Allocator const &A)
+ chain(Allocator const &A)
: alloc(A), strands(A) { }
chain(size_t len, Allocator const &A)
: alloc(A), strands(A)
@@ -159,7 +160,7 @@
Vector &vec = strands.back();
size_t len = std::distance(F,L);
vec.resize(len);
- Vector::iterator G = vec.begin();
+ typename Vector::iterator G = vec.begin();
for (size_t N = 0; N < len; ++F, ++G)
*G = *F;
}
Modified: sandbox/monotonic/boost/utility/iter_range.h
==============================================================================
--- sandbox/monotonic/boost/utility/iter_range.h (original)
+++ sandbox/monotonic/boost/utility/iter_range.h 2009-06-15 02:28:15 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
@@ -13,14 +13,16 @@
struct iter_range : std::pair<Iter, Iter>
{
typedef std::pair<Iter, Iter> Parent;
-
+ using Parent::first;
+ using Parent::second;
+
iter_range() { }
- iter_range(Iter const &A, Iter const &B)
+ iter_range(Iter const &A, Iter const &B)
: Parent(A,B) { }
size_t size() const
{
- return std::distance(first, second);
+ return std::distance(this->first, this->second);
}
bool empty() const
{
@@ -70,13 +72,15 @@
typedef typename Container::iterator iterator;
typedef iter_range_detail::iter_range<iterator> Parent;
typedef typename boost::iterator_value<iterator>::type Value;
+ using Parent::first;
+ using Parent::second;
iter_range() { }
- iter_range(Container &C)
- : Parent(C.begin(), C.end()) { }
- iter_range(iterator A)
+ iter_range(Container &cont)
+ : Parent(cont.begin(), cont.end()) { }
+ iter_range(iterator A)
: Parent(A,A) { }
- iter_range(iterator A, iterator B)
+ iter_range(iterator A, iterator B)
: Parent(A,B) { }
iter_range& operator++()
{
@@ -89,7 +93,7 @@
Parent::operator++(0);
return tmp;
}
- typename Value &operator*() const
+ Value &operator*() const
{
return *first;
}
@@ -102,16 +106,18 @@
typedef typename Container::const_iterator const_iterator;
typedef iter_range_detail::iter_range<const_iterator> Parent;
typedef typename boost::iterator_value<const_iterator>::type Value;
+ using Parent::first;
+ using Parent::second;
const_iter_range() { }
template <class C2>
const_iter_range(iter_range<C2> const &R)
: Parent(R.first, R.second) { }
- const_iter_range(Container const &C)
- : Parent(C.begin(), C.end()) { }
- const_iter_range(const_iterator A)
+ const_iter_range(Container const &cont)
+ : Parent(cont.begin(), cont.end()) { }
+ const_iter_range(const_iterator A)
: Parent(A,A) { }
- const_iter_range(const_iterator A, const_iterator B)
+ const_iter_range(const_iterator A, const_iterator B)
: Parent(A,B) { }
const_iter_range& operator++()
{
@@ -124,7 +130,7 @@
Parent::operator++(0);
return tmp;
}
- typename const Value &operator*() const
+ const Value &operator*() const
{
return *first;
}
Modified: sandbox/monotonic/libs/monotonic/test/main.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/main.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/main.cpp 2009-06-15 02:28:15 EDT (Mon, 15 Jun 2009)
@@ -52,7 +52,7 @@
cout << "deque: " << storage.used() << endl;
}
storage.reset();
-
+
{
std::vector<int, boost::monotonic::allocator<int> > vector(storage);
fill_n(back_inserter(vector), 100, 42);
@@ -495,10 +495,10 @@
do
{
swapped = false;
- List::iterator A = list.begin(), B = --list.end();
+ typename List::iterator A = list.begin(), B = --list.end();
for (--B; A != B; ++A)
{
- List::iterator C = A;
+ typename List::iterator C = A;
++C;
if (*A > *C)
{
@@ -519,7 +519,8 @@
boost::timer mono_timer;
for (size_t n = 0; n < count; ++n)
{
- test_bubble_sort_impl(length, std::list<int, monotonic::allocator<int> >(storage));
+ std::list<int, monotonic::allocator<int> > list(storage);
+ test_bubble_sort_impl(length, list);
storage.reset();
}
double mono_total = mono_timer.elapsed();
@@ -528,7 +529,8 @@
boost::timer std_timer;
for (size_t n = 0; n < count; ++n)
{
- test_bubble_sort_impl(length, std::list<int>());
+ std::list<int> list;
+ test_bubble_sort_impl(length, list);
}
double std_total = std_timer.elapsed();
cout << "std bubble sort: " << 1000*1000*std_total/count << "us" << endl;
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