|
Boost Users : |
From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2008-06-19 02:07:35
Hi:
Cheers lexical_cast wor perfectly.
Sean.
-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jurko Gospodnetic
Sent: 18 June 2008 18:08
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Converting an std::string to an int
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 mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3198 (20080618) __________
The message was checked by ESET NOD32 Antivirus.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3198 (20080618) __________
The message was checked by ESET NOD32 Antivirus.
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