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
This commit is contained in:
Fischlurch 2017-08-07 00:20:55 +02:00
parent 70e1a5b922
commit a7ad82c935

View file

@ -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;
}