Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56400 - sandbox/statistics/matrix_view/boost/matrix_view/iterator
From: erwann.rogard_at_[hidden]
Date: 2009-09-26 20:05:11


Author: e_r
Date: 2009-09-26 20:05:10 EDT (Sat, 26 Sep 2009)
New Revision: 56400
URL: http://svn.boost.org/trac/boost/changeset/56400

Log:
d
Removed:
   sandbox/statistics/matrix_view/boost/matrix_view/iterator/row_iterator.hpp

Deleted: sandbox/statistics/matrix_view/boost/matrix_view/iterator/row_iterator.hpp
==============================================================================
--- sandbox/statistics/matrix_view/boost/matrix_view/iterator/row_iterator.hpp 2009-09-26 20:05:10 EDT (Sat, 26 Sep 2009)
+++ (empty file)
@@ -1,129 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// view::iterator::row_iterator.hpp //
-// //
-// (C) Copyright 2009 Erwann Rogard //
-// Use, modification and distribution are subject to 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) //
-///////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_VIEW_ITERATOR_ROW_ITERATOR_HPP_ER_2009
-#define BOOST_VIEW_ITERATOR_ROW_ITERATOR_HPP_ER_2009
-#include <iterator>
-#include <algorithm>
-#include <cmath>
-#include <iostream>
-#include <boost/iterator/iterator_facade.hpp>
-#include <boost/iterator/iterator_traits.hpp>
-#include <boost/range.hpp>
-
-namespace boost{
-namespace view{
-
-// Should be rename rows_iterator
-// Maps a pair of iterators and a stride to an iterator that iterates over
-// ranges. In matrix terminology, ++row_iterator moves down one row.
-template<
- typename It,
- typename Categ = typename iterator_category<It>::type,
- typename Diff = typename iterator_difference<It>::type
->
-class row_iterator
- : public iterator_adaptor<
- row_iterator<It>
- , iterator_range<It>
- , Categ
- , iterator_range<It>
- , Diff
- >
-{
- typedef iterator_facade<
- row_iterator<It>
- , iterator_range<It>
- , Categ
- , iterator_range<It>
- , Diff
- > super_;
-
- public:
- row_iterator() : super_(){}
-
- explicit row_iterator(It i,std::size_t stride)
- :super_(),stride_(stride),base_iter(i){}
-
- row_iterator(const row_iterator& that)
- :super_(that),stride_(that.stride_),base_iter(that.base_iter){}
-
- // TODO probably not needed
- row_iterator& operator=(const row_iterator& that){
- if(&that!=this){
- super_::operator=(that);
- stride_ = that.stride_;
- base_iter = that.base_iter;
- }
- return *this;
- }
-
- It base(){ return base_iter; }
- std::size_t stride()const{ return stride_; }
- private:
- typedef iterator_range<It> Value;
-
- friend class iterator_core_access;
-
- void increment() {
- std::advance(this->base_iter,stride_);
- }
-
- Diff distance_to(row_iterator const& other) const{
- Diff d = std::distance(this->base_iter,other.base_iter);
- d /= static_cast<Diff>(this->stride());
- return d;
- };
-
- bool equal(row_iterator const& other) const
- {
- return this->base_iter == other.base_iter;
- }
-
- Value dereference() const {
- //Value& inappropriate as result is local
- It i = this->base_iter;
- std::advance(i,stride_);
- return make_iterator_range(this->base_iter,i);
- }
-
- void advance(Diff n)
- {
- std::advance(this->base_iter, n*stride());
- }
-
- std::size_t stride_;
- It base_iter;
-};
-
-template<typename It>
-row_iterator<It>
-make_end_row_iterator(It b,It e,std::size_t stride){
- //BOOST_ASSERT(std::distance(b,e)>0);
- BOOST_ASSERT( ( std::distance(b,e)>0 ) || ( std::distance(b,e)==0 ) );
- It ee = e;
- //std::size_t d = (std::size_t)(std::distance(b,ee)-1)/stride;
-
- std::size_t d = (std::size_t)(std::distance(b,ee))/stride;
- d *= stride;
- //ee = b; std::advance(ee,d+1);
- ee = b; std::advance(ee,d);
-
- return row_iterator<It>(ee,stride);
-}
-
-template<typename It>
-row_iterator<It>
-make_row_iterator(It b,std::size_t stride){
- return row_iterator<It>(b,stride);
-}
-
-}// view
-}// boost
-
-#endif


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