Boost Users :
From: Jurko GospodnetiÄ (jurko.gospodnetic_at_[hidden])
Date: 2008-06-18 13:07:52
> I need to convert and std::string to an int, should I use Lexical_cast
> or can I just use static_cast?
No way to use static_cast<> for this, but lexical_cast<> is ok.
One thing I do not know about lexical_cast is whether it does any
dynamic memory allocation internally which it should not need to do in
this specific case. Such memory allocation can throw std::bad_alloc
exceptions and may or may not be a performance bottleneck depending on
your use-case. If this bothers you, you can always use atoi() or
Hope this helps.
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