Boost logo

Boost Users :

From: Abir Basak (abirbasak_at_[hidden])
Date: 2008-03-18 03:58:35


Hi,
  though the document says the boost permutation_iterator base returns an
element iterator, but it seems actually returns the index iterator.
 eg,
typedef std::vector<int> VI;///index iterator
 VI v; v+=1,3,4;///indices
  typedef std::vector<double> VF;///element iterator
  VF v1; v1+=0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5;///elements
    typedef boost::permutation_iterator<VF::iterator,VI::iterator> PI;
    PI b1 = boost::make_permutation_iterator(v1.begin(),v.begin());
    PI e1 = boost::make_permutation_iterator(v1.begin(),v.end());
    for(PI it = b1; it!= e1; ++it){
        std::cout<<"IT "<<*it<<" B "<<*it.base()<<" ";
    }

what i need is to compare the permutation iterator with an original iterator
(i.e VF::iterator with PI like if(v1.begin()+1 == b1) or if(v1.begin()+1 ==
b1.base()) in this case which should return true)
but i am not finding any such way to compare these two iterators ....

thanks
abir



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