Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-03-03 08:41:43


Hi Pavol,

Downloaded the latest string_algo from the CVS. It seems to be buggy.

First of all, I expect the following to work:
std::string result;
boost::replace_range( result, "\r\n", "\n");

It fails, with a couple of errors (I'm using VC7.1).

Since the above failed, tried to create a function to be equivalent:

void replace( std::string & str, const char * find, const char * replace) {
    boost::replace_range( str, boost::make_range(find, find + strlen(find)),
        boost::make_range(replace, replace + strlen(replace)) );
}

This also fails to compile:
d:\boost\boost_latest_sandbox\boost-sandbox\boost\string_algo\iterator_range.hpp(96)
: error C2664:
'std::basic_string<_Elem,_Traits,_Ax>::iterator::iterator(std::basic_string<_Elem,_Traits,_Ax>::iterator::pointer)'
: cannot convert parameter 1 from 'const char *' to
'std::basic_string<_Elem,_Traits,_Ax>::iterator::pointer'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        and
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        Conversion loses qualifiers
        d:\john\projects\logview\log_handler.cpp(6) : see reference to
function template instantiation
'boost::iterator_range<IteratorT>::iterator_range<const char*>(const
boost::iterator_range<const char *> &)' being compiled
        with
        [
            
IteratorT=boost::string_algo::container_traits<std::string>::iterator
        ]
d:\boost\boost_latest_sandbox\boost-sandbox\boost\string_algo\iterator_range.hpp(96)
: error C2664:
'std::basic_string<_Elem,_Traits,_Ax>::iterator::iterator(std::basic_string<_Elem,_Traits,_Ax>::iterator::pointer)'
: cannot convert parameter 1 from 'const char *' to
'std::basic_string<_Elem,_Traits,_Ax>::iterator::pointer'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        and
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        Conversion loses qualifiers

This seems pretty unacceptable to me.

Best,
John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk