Boost logo

Boost Users :

From: Tom Matelich (tmatelich_at_[hidden])
Date: 2002-05-21 15:17:10


I and many others have requested fixes for this for a very long time.
Basically, it involves creating class templates to do the actual conversion.
It's not the most complicated system, just nobody has done it yet. If you
search the boost list archives, you'll see a lot of mail about this. There
is no quick solution to your problem though.

-----Original Message-----
From: Jason Fischl [mailto:yg-boost-users_at_[hidden]]
Sent: Monday, May 20, 2002 5:21 PM
To: boost-users_at_[hidden]
Subject: [Boost-Users] boost::lexical_cast string to string problem

I'm seeing a problem with lexical_cast. The following code when trying to
convert from string to
string fails when passed an empty string. The library code that is doing
this lexical_cast does
not and can not know that the input and output types are the same.

I believe that this code should not throw.

#include <iostream>
#include <boost/lexical_cast.hpp>

main()
{
   std::string input("");
   try
   {
      boost::lexical_cast<std::string>(input);
   }
   catch (boost::bad_lexical_cast& e)
   {
      std::cout << "Failed" << std::endl;
   }
}

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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