Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2007-02-20 15:43:35


On 2/20/07, Pavol Droba <droba_at_[hidden]> 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_range<string::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_range<string::iterator>. In your code, you
> misplaced it with string_split itself.
>

I change the integer_compare class to use iterator_range<string::iterator>&.

And I am trying to loop thru the iterator_range inside the function()
of integer_compare:

        bool operator() (const iterator_range<string::iterator>& a,
        
        const iterator_range<string::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_range<std::string>(*sitr) << endl;
                        
                }
               return true;
       }

But I get the following error saying I cant' instantiate
'boost::range_const_iterator<char>'.
Any more help is appreciated.

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"stringCompare.d"
-MT"stringCompare.d" -o"stringCompare.o" "../stringCompare.cpp"
../stringCompare.cpp:58:2: warning: no newline at end of file
/usr/include/boost/range/const_iterator.hpp: In instantiation of
'boost::range_const_iterator<char>':
/usr/include/boost/range/iterator_range.hpp:576: instantiated from
'SeqT boost::copy_range(const Range&) [with SeqT =
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>, Range = char]'
../stringCompare.cpp:28: instantiated from here
/usr/include/boost/range/const_iterator.hpp:36: error: 'char' is not a
class, struct, or union type
/usr/include/boost/range/iterator.hpp: In instantiation of
'boost::range_iterator<char>':
/usr/include/boost/range/iterator_range.hpp:576: instantiated from
'SeqT boost::copy_range(const Range&) [with SeqT =
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>, Range = char]'
../stringCompare.cpp:28: instantiated from here
/usr/include/boost/range/iterator.hpp:37: error: 'char' is not a
class, struct, or union type
/usr/include/boost/range/iterator_range.hpp: In function 'SeqT
boost::copy_range(const Range&) [with SeqT = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, Range = char]':
../stringCompare.cpp:28: instantiated from here
/usr/include/boost/range/iterator_range.hpp:576: error: no matching
function for call to 'begin(const char&)'
/usr/include/boost/range/iterator_range.hpp:576: error: no matching
function for call to 'end(const char&)'
make: *** [stringCompare.o] Error 1
make: Target `all' not remade because of errors.

> Regards,
> Pavol.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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