Hi, can I you lexical_cast to convert string "0x16" to 22? Thanx, Gennadiy.
On 12/20/01 1:32 PM, "rogeeff"
can I you lexical_cast to convert string "0x16" to 22?
Not without defining your own type to cast to. The behavior of lexical_cast is limited to what the stream input functions do by default. The operator>> for int will parse the "0" if presented with the string "0x16". On the other hand, there's nothing preventing you from using lexical_cast to cast to another type, in which case you can make it do anything you want, since it will call the operator>> overload for that type. -- Darin
On 12/20/01 1:32 PM, "rogeeff"
wrote: can I you lexical_cast to convert string "0x16" to 22?
Not without defining your own type to cast to.
The behavior of lexical_cast is limited to what the stream input functions do by default. The operator>> for int will parse the "0" if
--- In Boost-Users@y..., Darin Adler
the string "0x16".
On the other hand, there's nothing preventing you from using lexical_cast to cast to another type, in which case you can make it do anything you want, since it will call the operator>> overload for that type.
This solution I found either. But thank you anyway.
-- Darin
Gennadiy.
participants (2)
-
Darin Adler
-
rogeeff