Boost logo

Boost Users :

From: Pavol Droba (droba_at_[hidden])
Date: 2007-02-20 11:32:28


Meryl Silverburgh wrote:
>>
>> #include <iostream>
>> #include <string>
>>
>> #include "boost/algorithm/string/find_iterator.hpp"
>> #include "boost/algorithm/string/classification.hpp"
>> #include "boost/algorithm/string/predicate.hpp"
>>
>>
>> using namespace std;
>> using namespace boost;
>>
>> typedef split_iterator<string::iterator> string_split;
>>
>> class integer_compare {
>> public:
>> bool operator() (const string_split::value_type &a, const
>> string_split::value_type &b) {
>> return true;
>> }
>> };
>>
>> int main(int argc, char **argv) {
>> cout << "hello world" << endl;
>>
>> string s1("/1/11/2");
>> string s2("/1/1/3");
>>
>> iterator_range<string_split> r1(
>> make_split_iterator(s1,
>> token_finder(is_any_of("/")), string_split());
>>
>> iterator_range<string_split> r2(
>> make_split_iterator(s2,
>> token_finder(is_any_of("/")), string_split());
>>
>> if(lexicographical_compare(r1.begin(), r1.end(),
>>
>> r2.begin(), r2.end(), integer_compare()))
>> {
>> cout << " s1 is less " << endl;
>> } else {
>> cout << " s2 is less " << endl;
>> }
>>
>>
>> }
>>
> i have added '#include "boost/algorithm/string/finder.hpp"' but it
> still does not solve my error.
>

A missing parenthesis is missing there. Instead of

iterator_range<string_split> r1(
make_split_iterator(s1, token_finder(is_any_of("/")), string_split());

you should write:

iterator_range<string_split> r1(
make_split_iterator(s1, token_finder(is_any_of("/"))), string_split());

parenthesis is missing just after token_finder.

Regards,
Pavol.


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