werehuman
01.08.2011 12:06 Psi+
Question: Why does lexical_cast<int8_t>("127") throw bad_lexical_cast?
Answer: The type int8_t is a typedef to char or signed char. Lexical conversion to these types is simply reading a byte from source but since the source has more than one byte, the exception is thrown. Please use other integer types such as int or short int. If bounds checking is important, you can also call numeric_cast:
я может что-то путаю, но 127 вроде как помещается даже в сигнед чар
хехехе, "127" воспринимается как массив из трёх char
а :)