|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59328 - in sandbox/statistics/iterator: boost/iterator libs/iterator/example
From: erwann.rogard_at_[hidden]
Date: 2010-01-28 01:16:45
Author: e_r
Date: 2010-01-28 01:16:44 EST (Thu, 28 Jan 2010)
New Revision: 59328
URL: http://svn.boost.org/trac/boost/changeset/59328
Log:
m
Text files modified:
sandbox/statistics/iterator/boost/iterator/flatten_iterator.hpp | 12 +++++++++---
sandbox/statistics/iterator/libs/iterator/example/flatten_iterator.cpp | 19 ++-----------------
2 files changed, 11 insertions(+), 20 deletions(-)
Modified: sandbox/statistics/iterator/boost/iterator/flatten_iterator.hpp
==============================================================================
--- sandbox/statistics/iterator/boost/iterator/flatten_iterator.hpp (original)
+++ sandbox/statistics/iterator/boost/iterator/flatten_iterator.hpp 2010-01-28 01:16:44 EST (Thu, 28 Jan 2010)
@@ -72,16 +72,22 @@
flatten_iterator(const flatten_iterator& that)
:super_(that),b_(that.b_),e_(that.e_)
{
- this->update();
+ if(!this->is_end()){
+ nb_ = (that.nb_);
+ ne_ = (that.ne_);
+ }
}
flatten_iterator&
operator=(const flatten_iterator& that){
- if(that!=&this){
+ if(&that!=this){
super_::operator=(that);
this->b_ = that.b_;
this->e_ = that.e_;
- this->update();
+ if(!this->is_end()){
+ nb_ = (that.nb_);
+ ne_ = (that.ne_);
+ }
}
return (*this);
}
Modified: sandbox/statistics/iterator/libs/iterator/example/flatten_iterator.cpp
==============================================================================
--- sandbox/statistics/iterator/libs/iterator/example/flatten_iterator.cpp (original)
+++ sandbox/statistics/iterator/libs/iterator/example/flatten_iterator.cpp 2010-01-28 01:16:44 EST (Thu, 28 Jan 2010)
@@ -37,35 +37,20 @@
flat_it_ b(boost::begin(mat),boost::end(mat));
flat_it_ e(boost::end(mat),boost::end(mat));
- int j = 0;
int n = std::distance(b,e);
os << "n=" << n << std::endl;
BOOST_ASSERT(
n == boost::size(mat[0]) + boost::size(mat[1]) + boost::size(mat[2])
);
flat_it_ i = b;
- BOOST_ASSERT(i==b);
- ++i;
- BOOST_ASSERT(i!=b);
- // temporary --->
- //n = b.distance_to(i);
- //BOOST_ASSERT(n==1);
- //n = i.distance_to(b);
- //BOOST_ASSERT(n==-1);
- // <---
- n = std::distance(b,i); // fails : should be 1
- os << "n=" << n << std::endl;
-
-
-/*
+ int j = 0;
for(; i!=e; i++, j++){
val_ val = *i;
BOOST_ASSERT(val == j+1);
diff_ d = std::distance(i,e);
- std::cout << "d = " << d << std::endl;
BOOST_ASSERT(d==n-j);
}
-*/
+
}
/*
{
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