From b4eea515c36e2ff315222e08cd5f7224bb0b10f0 Mon Sep 17 00:00:00 2001 From: Lukhnos Liu Date: Fri, 14 Jun 2013 23:53:52 -0700 Subject: [PATCH] Fix Span removal bug when linked against libc++ --- Source/Engine/Gramambular/Span.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Gramambular/Span.h b/Source/Engine/Gramambular/Span.h index 363b70c3..87cb6563 100644 --- a/Source/Engine/Gramambular/Span.h +++ b/Source/Engine/Gramambular/Span.h @@ -29,6 +29,7 @@ #define Span_h #include +#include #include #include "Node.h" @@ -76,9 +77,10 @@ namespace Formosa { } size_t max = 0; - for (map::iterator i = m_lengthNodeMap.begin() ; i != m_lengthNodeMap.end() ; ++i) { + set removeSet; + for (map::iterator i = m_lengthNodeMap.begin(), e = m_lengthNodeMap.end() ; i != e ; ++i) { if ((*i).first > inLength) { - m_lengthNodeMap.erase(i); + removeSet.insert((*i).first); } else { if ((*i).first > max) { @@ -87,6 +89,10 @@ namespace Formosa { } } + for (set::iterator i = removeSet.begin(), e = removeSet.end(); i != e; ++i) { + m_lengthNodeMap.erase(*i); + } + m_maximumLength = max; }