2010/12/10 Rao, Anant <Anant.Rao@ironmountain.com>
Hi Eric,
Yes, it was a typo  on my part to use ++ when I shd have had a --.
But, I was talking about the compile error. That is, even if I had a '--', it would still complain.
The offending line is:

while( cp != ire )
{
 //Do something
 cp--;
}


Please bear with me as I (hopefully) make my requirement statement more precise:

Fwd:
iterator_range<char*> ir( &s[0], &s[ strlen(s) ] );

for (cp = (char*)ir.begin(); cp != (char*)ir.end(); ++cp)
{
      cout << "cp in ri [" << *cp << "]\n";
}

I want similar code (using 'cp') to traverse backwards using 'ir' or another container-in-reverse mode.


The thing is, a pointer is an iterator, but an iterator is not necessarily a pointer. The iterator returned by boost::begin(ir) happens to be char*, because ir is an iterator_range<char*>. But boost::rbegin(ir) doesn't return anything convertible to char*. Rbegin returns an iterator - a reverse iterator wrapper arounc char*, but not convertible to char*.

Maybe You will receive some more useful help if You explain why You need to convert a reverse iterator to char* ;-)

Regards, Kris