|
Boost Users : |
From: john.wismar_at_[hidden]
Date: 2005-11-18 16:00:20
We've noticed some changed behavior in a module that's using lexical_cast,
having gone from 1.32.0 to 1.33.0. I tracked it down to this change:
1.32.0:
bool operator>>(InputStreamable &output)
{
return !is_pointer<InputStreamable>::value &&
stream >> output &&
(stream >> std::ws).eof();
}
1.33.0:
bool operator>>(InputStreamable &output)
{
return !is_pointer<InputStreamable>::value &&
stream >> output &&
stream.get() ==
#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING)
// GCC 2.9x lacks std::char_traits<>::eof().
// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3
// configurations, which do provide std::char_traits<>::eof().
EOF;
#else
std::char_traits<char_type>::eof();
#endif
}
It turns out that we are passing a string containing a number with a
trailing space. The 1.32.0 version of lexical_cast did not mind the
trailing space, but the 1.33.0 version throws a bad_lexical_cast
exception. I found that if I change this:
stream.get() ==
to this:
(stream >> std::ws).get() ==
that my issue goes away, but the workaround for compilers without the
eof() function still works.... Would it be possilbe to add this into
1.34.0, or is this undesirable behavior?
--------------------------------
John Wismar
john.wismar_at_[hidden]
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