From a9cf9fa3599b2045941d154dc91aba5a45beabb7 Mon Sep 17 00:00:00 2001 From: Thomas Alexander Date: Tue, 26 Mar 2024 08:23:28 -0300 Subject: [PATCH] Fix debug build on OSX (#33) Closes #32. Fixes iteration of tokens on OSX. --- include/qasm/AST/ASTBase.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; }