Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8261: lexical_cast<unsigned> returns unexpected result when using with split_iterator<std::wstring::iterator>
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-29 09:44:38
#8261: lexical_cast<unsigned> returns unexpected result when using with
split_iterator<std::wstring::iterator>
---------------------------------------+------------------------------------
Reporter: s.a.moreno.a.s@⦠| Owner: apolukhin
Type: Bugs | Status: new
Milestone: To Be Determined | Component: lexical_cast
Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------+------------------------------------
Comment (by apolukhin):
This is a known problem, which is very hard to solve in s good, portable
and generic way.
As a temporary workaround you may use the following solution:
{{{
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
int main() {
const wchar_t wstr[] = L"20.20";
typedef boost::split_iterator<const wchar_t*> wsplit_iter_t;
wsplit_iter_t wdot_iter = boost::make_split_iterator( wstr,
boost::first_finder(L"."));
std::cout << boost::lexical_cast<unsigned>(*wdot_iter++)
<< '.'
<< boost::lexical_cast<unsigned>(*wdot_iter++);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8261#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC