Boost logo

Boost Users :

Subject: [Boost-users] [boost.stringalgo] issue
From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2009-05-11 08:43:51


Hi list:
I am in the process of using boost::algorithm::replace_all with the
following tuple:
Boost::tuple<DWORD, boost::filesystem::wpath>
If I use the code below:
                std::wstring temp1, temp2, temp3;
temp1 =ProcInfo.get<1>().string();
temp2 =ProcInfo.get<1>().filename();
temp3 =L"dolapi.dll";
boost::algorithm::replace_all(temp1, temp2, temp3);
The code compiles fine, How ever if I use:
boost::algorithm::replace_all(ProcInfo.get<1>().string(),
ProcInfo.get<1>().filename(), L"dolapi.dll");
Compiling...
TPProductsSR.cpp
c:\program
files\boost\boost\algorithm\string\detail\find_format_all.hpp(250) :
error C2664: 'boost::algorithm::detail::erase' : cannot convert
parameter 2 from 'input_iterator_type' to
'std::_String_iterator<_Elem,_Traits,_Alloc>'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits,
            _Alloc=std::allocator
        ]
        No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
        c:\program
files\boost\boost\algorithm\string\detail\find_format_all.hpp(185) : see
reference to function template instantiation 'void
boost::algorithm::detail::find_format_all_impl2<INPUTT,FINDERT,FORMATTER
T,FINDRESULTT,BOOST::ITERATOR_RANGE>(InputT
&,FinderT,FormatterT,FindResultT,FormatResultT)' being compiled
        with
        [
            InputT=const
std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
 
FinderT=boost::algorithm::detail::first_finderF<STD::_STRING_CONST_ITERA
TOR<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,boost::algorithm::is_equal>
,
 
FormatterT=boost::algorithm::detail::const_formatF<BOOST::ITERATOR_RANGE
>,
 
FindResultT=boost::iterator_range<STD::_STRING_CONST_ITERATOR<WCHAR_T,ST
D::CHAR_TRAITS,std::allocator>>,
            IteratorT=const wchar_t *,
            FormatResultT=boost::iterator_range
        ]
        c:\program
files\boost\boost\algorithm\string\find_format.hpp(254) : see reference
to function template instantiation 'void
boost::algorithm::detail::find_format_all_impl<SEQUENCET,FINDERT,FORMATT
ERT,BOOST::ITERATOR_RANGE>(InputT &,FinderT,FormatterT,FindResultT)'
being compiled
        with
        [
            SequenceT=const
std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
 
FinderT=boost::algorithm::detail::first_finderF<STD::_STRING_CONST_ITERA
TOR<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,boost::algorithm::is_equal>
,
 
FormatterT=boost::algorithm::detail::const_formatF<BOOST::ITERATOR_RANGE
>,
 
IteratorT=std::_String_const_iterator<WCHAR_T,STD::CHAR_TRAITS,std::allo
cator>,
            InputT=const
std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
 
FindResultT=boost::iterator_range<STD::_STRING_CONST_ITERATOR<WCHAR_T,ST
D::CHAR_TRAITS,std::allocator>>
        ]
        c:\program files\boost\boost\algorithm\string\replace.hpp(657) :
see reference to function template instantiation 'void
boost::algorithm::find_format_all<SEQUENCET,BOOST::ALGORITHM::DETAIL::FI
RST_FINDERF,boost::algorithm::detail::const_formatF>(SequenceT
&,FinderT,FormatterT)' being compiled
        with
        [
            SequenceT=const
std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
 
SearchIteratorT=std::_String_const_iterator<WCHAR_T,STD::CHAR_TRAITS,std
::allocator>,
            PredicateT=boost::algorithm::is_equal,
            RangeT=boost::iterator_range,
 
FinderT=boost::algorithm::detail::first_finderF<STD::_STRING_CONST_ITERA
TOR<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,boost::algorithm::is_equal>
,
 
FormatterT=boost::algorithm::detail::const_formatF<BOOST::ITERATOR_RANGE
>
        ]
        d:\work\access for
everyone\ghg\tpproductssr\tpproductssr.cpp(41) : see reference to
function template instantiation 'void
boost::algorithm::replace_all,std::basic_string<_Elem,_Traits,_Ax>,const
wchar_t[11]>(SequenceT &,const Range1T &,Range2T (&))' being compiled
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits,
            _Ax=std::allocator,
            SequenceT=const
std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
 
Range1T=std::basic_string<WCHAR_T,STD::CHAR_TRAITS,std::allocator>,
            Range2T=const wchar_t [11]
        ]
c:\program
files\boost\boost\algorithm\string\detail\find_format_all.hpp(255) :
error C2664: 'boost::algorithm::detail::insert' : cannot convert
parameter 2 from 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' to
'std::_String_iterator<_Elem,_Traits,_Alloc>'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits,
            _Alloc=std::allocator
        ]
        No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
Using visual c++ 2008 on a windows xp box, not that this (the o/s at
least) matters.
How can I avoid creating temporary variables in this case?
Any help appreciated.
Sean.
 

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4061 (20090507) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 



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