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:
parent
70e1a5b922
commit
a7ad82c935
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue