diff --git a/include/qasm/AST/ASTBase.h b/include/qasm/AST/ASTBase.h index e11dc49..4f4689e 100644 --- a/include/qasm/AST/ASTBase.h +++ b/include/qasm/AST/ASTBase.h @@ -201,12 +201,10 @@ class ASTTokenFactory { } static const ASTToken *GetPreviousToken() { - std::map::const_reverse_iterator MRI = TFM.rbegin(); - if (MRI == TFM.rend()) + if (TFM.empty()) return nullptr; - --MRI; - return MRI == TFM.rend() ? nullptr : (*MRI).second; + return std::prev(TFM.end())->second; } static uint32_t GetCurrentIndex() { return TIX; }