|
Boost Users : |
From: Stephan Höfer (yg-boost-users_at_[hidden])
Date: 2003-08-19 01:41:02
After changing boost::lexical_cast<unsigned short>(aStr); to
boost::lexical_cast<unsigned short>(aStr.c_str());
I had no problem compiling the program.
Cheers,
Stephan
Charles Schwartz schrieb:
> fisrt of all: ok, I erred in the // (they did not appear in the original
> program).
>
> Re: vers., it's boost vers. 1_30_0
>
> here's more info re the error, even admitting your changes:
>
> ----------
> ------ Build started: Project: UnsignedShort, Configuration: Debug
> Win32 ------
>
> Compiling...
> UnsignedShort.cpp
> c:\Boost\boost_1_30_0\boost\lexical_cast.hpp(147) : error C2679: binary '<<'
> : no operator found which takes a right-hand operand of type 'const
> std::string' (or there is no acceptable conversion)
> c:\Boost\boost_1_30_0\boost\lexical_cast.hpp(146) : while compiling
> class-template member function 'bool
> boost::detail::lexical_stream<Target,Source>::operator <<(const Source &)'
> with
> [
> Target=unsigned short,
> Source=std::string
> ]
> c:\Boost\boost_1_30_0\boost\lexical_cast.hpp(189) : see reference to
> class template instantiation 'boost::detail::lexical_stream<Target,Source>'
> being compiled
> with
> [
> Target=unsigned short,
> Source=std::string
> ]
> c:\Documents and Settings\schwartc\My Documents\Visual Studio
> Projects\boost_lexical_cast\UnsignedShort\UnsignedShort.cpp(12) : see
> reference to function template instantiation 'Target
> boost::lexical_cast<unsigned short,std::string>(Source)' being compiled
> with
> [
> Target=unsigned short,
> Source=std::string
> ]
>
> UnsignedShort - 1 error(s), 0 warning(s)
>
> ---------------------- Done ----------------------
>
> Build: 0 succeeded, 1 failed, 0 skipped
> "Charles Schwartz" <yg-boost-users_at_[hidden]> wrote in message
> news:bhjc0f$c7q$1_at_sea.gmane.org...
> > If possible, please advise.
> >
> > using lexical cast w/unsigned short fails, on MSVC7:
> >
> > #include <boost\lexical_cast.hpp>
> > #include <iostream>
> >
> > int _tmain(int argc, _TCHAR* argv[])
> > {
> > std::string aStr("2");
> > unsigned short i = boost::lexical_cast<unsigned short>(aStr); \\ ERROR!
> >
> > std::cout << i << std::endl;
> > return 0;
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> > 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/
> >
> >
> >
>
>
> 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