[boost.stringalgo] issue

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

Sean Farrow skrev:
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");
is .string() returning a mutable reference? -Thorsten

Hi: What is the best way of checking this. Chers Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen Sent: 11 May 2009 18:47 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.stringalgo] issue Sean Farrow skrev:
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");
is .string() returning a mutable reference? -Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

Hi: It doesn't appear to, the filename declaration is: String_type Filename() const Any suggestions. Chers Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen Sent: 12 May 2009 20:02 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.stringalgo] issue Sean Farrow skrev:
Hi: What is the best way of checking this. Chers look in the docs for filesystem.
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

Hi: True, good point. I'll leave the code as is then. Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen Sent: 12 May 2009 21:57 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.stringalgo] issue Sean Farrow skrev:
Hi: It doesn't appear to, the filename declaration is: String_type Filename() const
How the h*** do you expect to erase from an rvalue? :-) (we need move semantics to do that. You have to cache the container/string you are erasing values in. -Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
participants (2)
-
Sean Farrow
-
Thorsten Ottosen