This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Exploit move semantics in std::accumulate.


On Tue, 11 Jan 2011, Paolo Carlini wrote:

Why use x=move(x)+y and not x+=y?
if we do this (good point)...

std::string operator+(std::string const&,MyType){...}
std::string operator+(std::string&&,MyType)=delete;
... then this shouldn't be an issue anymore, right?

But then the user could have defined


std::string operator+(std::string const&,MyType){...}

but not operator+=(std::string&,MyType)

If you want it to be equivalent, I don't think you can avoid making a list of cases known to work.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]