X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fdynamic.h;h=a62805090dd9058938830571b6112c77bf273624;hb=fc91e3033ab178ae85b54594f7dd09594de19b57;hp=47a40d991e3e3d5ce52933d1f9cbfd3789919613;hpb=ed8c80a0e0988e4ce687f51ca832a00e4a6b7930;p=folly.git diff --git a/folly/dynamic.h b/folly/dynamic.h index 47a40d99..a6280509 100644 --- a/folly/dynamic.h +++ b/folly/dynamic.h @@ -99,12 +99,17 @@ struct dynamic : private boost::operators { private: typedef std::vector Array; public: + typedef Array::iterator iterator; typedef Array::const_iterator const_iterator; typedef dynamic value_type; + struct const_key_iterator; struct const_value_iterator; struct const_item_iterator; + struct value_iterator; + struct item_iterator; + /* * Creation routines for making dynamic objects and arrays. Objects * are maps from key to value (so named due to json-related origins @@ -320,6 +325,8 @@ public: */ const_iterator begin() const; const_iterator end() const; + iterator begin(); + iterator end(); private: /* @@ -335,6 +342,8 @@ public: IterableProxy keys() const; IterableProxy values() const; IterableProxy items() const; + IterableProxy values(); + IterableProxy items(); /* * AssociativeContainer-style find interface for objects. Throws if @@ -344,6 +353,7 @@ public: * const_item_iterator pointing to the item. */ const_item_iterator find(dynamic const&) const; + item_iterator find(dynamic const&); /* * If this is an object, returns whether it contains a field with @@ -475,19 +485,17 @@ public: * removed, or end() if there are none. (The iteration order does * not change.) */ - const_iterator erase(const_iterator it); - const_iterator erase(const_iterator first, const_iterator last); + iterator erase(const_iterator it); + iterator erase(const_iterator first, const_iterator last); const_key_iterator erase(const_key_iterator it); const_key_iterator erase(const_key_iterator first, const_key_iterator last); - const_value_iterator erase(const_value_iterator it); - const_value_iterator erase(const_value_iterator first, - const_value_iterator last); + value_iterator erase(const_value_iterator it); + value_iterator erase(const_value_iterator first, const_value_iterator last); - const_item_iterator erase(const_item_iterator it); - const_item_iterator erase(const_item_iterator first, - const_item_iterator last); + item_iterator erase(const_item_iterator it); + item_iterator erase(const_item_iterator first, const_item_iterator last); /* * Append elements to an array. If this is not an array, throws * TypeError. @@ -544,9 +552,7 @@ private: explicit Data() : nul(nullptr) {} ~Data() {} - // XXX: gcc does an ICE if we use std::nullptr_t instead of void* - // here. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50361 - void* nul; + std::nullptr_t nul; Array array; bool boolean; double doubl;