Meguhine's blog

By Meguhine, history, 4 weeks ago, In English

AC code link

TLE code link

I only add std::move() manually to the TLE code, and it got AC.

But why ????? Shouldn't the Compiler add std::move() automatically ??????

diff

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Meguhine (previous revision, new revision, compare).

»
4 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

That kind of optimization usually works if you return named object, not braced ctor.

»
4 weeks ago, # |
  Vote: I like it +15 Vote: I do not like it

Move is not added automatically unless you return something directly. If it is part of pair/tuple/array — no dice. Now imagine there was a c++ grade performing language with no hidden coppies...