Hi, Meryl Silverburgh wrote:
On 2/20/07, Pavol Droba
wrote: Pavol,
Thank for your help. I thought you said 'The question marks can be substituted by string_split::value_type'. In one of our previous exchange.
That is why I am using 'string_split::value_type' not 'iterator_rangestring::iterator'
Sorry if I mis-understand what you teach me.
No worries.
There is no problem with using string_split::value_type. It is just a typedef to iterator_rangestring::iterator. In your code, you misplaced it with string_split itself.
I change the integer_compare class to use iterator_rangestring::iterator&.
And I am trying to loop thru the iterator_range inside the function() of integer_compare:
bool operator() (const iterator_rangestring::iterator& a,
const iterator_rangestring::iterator& b) { cout << "calling integer_compare " << endl;
// expect to print out "", "1", "1", "2" for a string of "/1/1/2" for (string::iterator sitr = a.begin(); sitr != a.end(); sitr++) {
cout << copy_rangestd::string(*sitr) << endl;
} return true; }
Please, see the iterator_range documentation: http://www.boost.org/libs/range/doc/utility_class.html#iter_range Although you changed the names of parameters, you are still using iterator_range as if it was a split_iterator. copy_range copies a *range* to a given container. when you dereference a string::iterator, you will not get a *range*, rather a single character. Instead of "for" loop you should use just cout << copy_rangestd::string(a) << endl; Regards, Pavol.