lexical_cast fails when src inserts 0 chars into stream.
The following code works with 1.46.1 but fails with a bad_lexical_cast
exception on 1.48.
#include <string>
#include <iostream>
#include <boost/lexical_cast.hpp>
struct my_string
{
friend std::ostream &operator<<(std::ostream& sout, my_string const& st)
{
return sout << "";
}
};
int main()
{
try
{
my_string st;
std::string st2 = boost::lexical_cast<std::string>(st);
}
catch(boost::bad_lexical_cast const &e)
{
std::cout << e.what() << std::endl;
}
}
Change History
(3)
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Duplicates #6264, #6298
Already fixed in trunk, fixes merged to 1.49.0
Tests were updated with your example