Блог пользователя Meguhine

Автор Meguhine, история, 15 месяцев назад, По-английски

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

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

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

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

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...