Commit f9fd348f authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

doc fix for dynamic::operator[]

Summary:
folly::dynamic's operator[] was documented as never invalidating
iterators.  In the object case when a key is implicitly inserted the
underlying unordered_map can rehash, which does invalidate the iterators.
This diff amends the comment to reflect this case.

Reviewed By: yfeldblum

Differential Revision: D7085861

fbshipit-source-id: 41ce0497bc60dba9f4529d10010f3b92f9a6c2b3
parent a5222860
......@@ -403,14 +403,16 @@ struct dynamic : private boost::operators<dynamic> {
/*
* This works for access to both objects and arrays.
*
* In the case of an array, the index must be an integer, and this will throw
* std::out_of_range if it is less than zero or greater than size().
* In the case of an array, the index must be an integer, and this
* will throw std::out_of_range if it is less than zero or greater
* than size().
*
* In the case of an object, the non-const overload inserts a null
* value if the key isn't present. The const overload will throw
* std::out_of_range if the key is not present.
*
* These functions do not invalidate iterators.
* These functions do not invalidate iterators except when a null value
* is inserted into an object as described above.
*/
dynamic& operator[](dynamic const&) &;
dynamic const& operator[](dynamic const&) const&;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment