Boost logo

Boost Users :

Subject: Re: [Boost-users] cycle iterators
From: er (erwann.rogard_at_[hidden])
Date: 2009-09-01 14:35:57


Steven Watanabe wrote:
> AMDG

> What does the default constructor have to do with it?
>
> Also, the enable_if you
> put on it is wrong.
>

Since enable_if is wrong (no ::type), then I guess it is the other
change (accessing the base through super_t) which corrects the problem
below, right?

#include <vector>
#include <boost/range.hpp>
#include <boost/iterator/cycle_iterator.hpp>
#include <boost/iterator/cycle_iterator_ext.hpp>

void example_iter(std::ostream& os){

     using namespace boost;
     typedef double val_;
     typedef std::vector<val_> vec_;
     typedef range_size<vec_>::type size_;
     typedef range_iterator<vec_>::type base_it_;
     const unsigned n = 10;
     vec_ vec(n);

     typedef cycle_iterator<base_it_,size_> it_;
     typedef cycle_iterator_ext<base_it_,size_> it_ext_;

     it_ it(boost::begin(vec),boost::end(vec),0);
     it_ext_ it_ext(boost::begin(vec),boost::end(vec),0);

     it_ it2;
     //it2 = it; //error: attempt to copy from a singular iterator.

     it_ext_ it_ext2;
     it_ext2 = it_ext;

}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net