Re: std::ostringstream unexpected behavior with .net 2003.
"Nathalie D'Amours" <email@example.com> wrote...
> I am using Microsoft VC .net 2003 and the std::ostringstream seams to
> in an unexpected way.
> int i = 3;
> std::ostringstream os;
> os << i << std::ends;
> std::string s1 = os.str();
> std::string s2("3");
> bool result = (s1 == s2);
> When I execute this code, 'result' gets set to false. Obviously I am
> expecting the strings to be identical. I've stepped in the comparison
> and the internal call to ::strcmp correctly returns 0 but then there is
> logic to compare the string lengths and they differ. s1 size is 2 and s2
> is 1 and this is why the comparison function returns false.
> This seems buggy to me. Am I missing something?
Yes. Drop the "<< std::ends".
> Has anyone else seen the
> same problem?
Probably. I haven't.
|All times are GMT. The time now is 11:08 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.