[Bug libstdc++/59048] std::string operator== between std::string and const char* creates unecessary temporary object

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 8 11:18:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59048

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Luca Stoppa from comment #0)
> Template functions
> bool operator==( const char*, const std::string& ) and
> bool operator==( const std::string&, const char* )
> creates unecessary temporary std::string object.

Where?

> It seems like that f()
> and h() are creating a temporary std::string object.

If you look at the code or use a debugger you can see there is no temporary
created, so you'll need to explain why you think that.



More information about the Gcc-bugs mailing list