From a7ad82c935deb37e95c54c6fdd98fb34b23f273d Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 7 Aug 2017 00:20:55 +0200 Subject: [PATCH] Library: can optimise IterStack pop() ...by moving out the element to be extracted; because of RVO it will in fact be move constructed into the storage of the caller --- src/lib/iter-stack.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/iter-stack.hpp b/src/lib/iter-stack.hpp index 16b9511f5..dec50b321 100644 --- a/src/lib/iter-stack.hpp +++ b/src/lib/iter-stack.hpp @@ -150,7 +150,7 @@ namespace lib { pop() { this->__throw_if_empty(); - TY topElement (this->stateCore().back()); + TY topElement (std::move (this->stateCore().back())); this->stateCore().pop_back(); return topElement; } @@ -218,7 +218,7 @@ namespace lib { pop() { this->__throw_if_empty(); - TY firstElement (this->stateCore().back()); + TY firstElement (std::move (this->stateCore().back())); this->stateCore().pop_back(); return firstElement; }