From 346d04a256b81988dcb45f765cf3478dab0b035d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:55:32 +0200 Subject: [PATCH] Work around buggy list::remove in libc++ --- dtool/src/dtoolbase/plist.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dtool/src/dtoolbase/plist.h b/dtool/src/dtoolbase/plist.h index 4ebc2899eb..91de207835 100644 --- a/dtool/src/dtoolbase/plist.h +++ b/dtool/src/dtoolbase/plist.h @@ -49,6 +49,19 @@ public: typedef TYPENAME base_class::const_iterator const_iterator; typedef TYPENAME base_class::reverse_iterator reverse_iterator; typedef TYPENAME base_class::const_reverse_iterator const_reverse_iterator; + + // This exists because libc++'s remove implementation has a bug with + // Panda's allocator class. + INLINE void remove(const Type &val) { + iterator it = this->begin(); + while (it != this->end()) { + if (*it == val) { + it = this->erase(it); + } else { + ++it; + } + } + }; }; #endif // USE_STL_ALLOCATOR