
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; }

well, when I change _tmain to main and _TCHAR to char and the \\ to // it compiles and runs (debug compile) on vs.net2003 boost extracted from CVS yesterday btw, when you say \\ERROR what do you mean? what version of boost are you using? At Friday 2003-08-15 12:24, you wrote:
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; }
Yahoo! Groups Sponsor ADVERTISEMENT
Info: <<http://www.boost.org>http://www.boost.org> Wiki: <<http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@yahoogroups.com>
Your use of Yahoo! Groups is subject to the <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"

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@m.gmane.org> wrote in message news:bhjc0f$c7q$1@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@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

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@m.gmane.org> wrote in message news:bhjc0f$c7q$1@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@yahoogroups.com>
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@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (3)
-
Charles Schwartz
-
Stephan Höfer
-
Victor A. Wagner, Jr.