Opened 11 years ago
Closed 11 years ago
#5746 closed Bugs (fixed)
Bugs in lexical_cast<unsigned_char> and <long long>
Reported by: | John Maddock | Owned by: | Antony Polukhin |
---|---|---|---|
Milestone: | Boost 1.48.0 | Component: | lexical_cast |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following expressions throw bad_lexical_cast exceptions, when I believe they should succeed just fine:
boost::lexical_cast<unsigned char>("128"); boost::lexical_cast<unsigned char>("64");
Conversion from smaller numbers such as "2" work just fine
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Milestone: | To Be Determined → Boost 1.48.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
lexical_cast library works just like std::stringstream. Lexical conversion to char, signed char and unsigned char is simply reading a byte from source but since the source has more than one byte, the exception is thrown.
Such situations are described in FAQ, but not very obvious. I'll update the FAQ.