-
-
Save Borgleader/f17c28073a81e8e39749 to your computer and use it in GitHub Desktop.
I like to std::move it std::move it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AstNodePtr CompileMulDiv(TokenIterator& it, TokenIterator& end) | |
{ | |
auto lhs = CompileTerm(it, end); | |
for (;;) | |
{ | |
if (it->id() == TokenType::Multiply) | |
{ | |
IncrIter(it); | |
lhs = std::move(AstNodePtr(new BinaryOpNode(TokenType::Multiply, std::move(lhs), CompileTerm(it, end)))); | |
} | |
else if (it->id() == TokenType::Divide) | |
{ | |
IncrIter(it); | |
lhs = std::move(AstNodePtr(new BinaryOpNode(TokenType::Divide, std::move(lhs), CompileTerm(it, end)))); | |
} | |
else | |
break; | |
} | |
return lhs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typedef std::unique_ptr AstNodePtr;