Boost logo

Boost Users :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-06-18 13:07:52

   Hi Sean.

> 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
something similar.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at