Skip to content
Browse files

folly::dynamic: comment about std::vector const-iter erase issue

Test Plan: none

Reviewed By: delong.j@fb.com

FB internal diff: D543196
  • Loading branch information...
1 parent e6ceb4c commit 5d3f05bdb60f074eae1301e2ccb9b2a9a4e2a2b3 @andrewjcg andrewjcg committed with tudor Aug 8, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 folly/dynamic-inl.h
View
3 folly/dynamic-inl.h
@@ -587,6 +587,9 @@ inline std::size_t dynamic::erase(dynamic const& key) {
inline dynamic::const_iterator dynamic::erase(const_iterator it) {
auto& arr = get<Array>();
+ // std::vector doesn't have an erase method that works on const iterators,
+ // even though the standard says it should, so this hack converts to a
+ // non-const iterator before calling erase.
return get<Array>().erase(arr.begin() + (it - arr.begin()));
}

0 comments on commit 5d3f05b

Please sign in to comment.
Something went wrong with that request. Please try again.