|
Boost Users : |
From: Darin Adler (darin_at_[hidden])
Date: 2001-12-20 23:42:31
On 12/20/01 1:32 PM, "rogeeff" <rogeeff_at_[hidden]> 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 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
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