We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd46119 commit 6a506d5Copy full SHA for 6a506d5
src/univalue/include/univalue.h
@@ -70,6 +70,8 @@ class UniValue {
70
71
size_t size() const { return values.size(); }
72
73
+ void reserve(size_t new_cap);
74
+
75
void getObjMap(std::map<std::string,UniValue>& kv) const;
76
bool checkObject(const std::map<std::string,UniValue::VType>& memberTypes) const;
77
const UniValue& operator[](const std::string& key) const;
src/univalue/lib/univalue.cpp
@@ -240,3 +240,10 @@ const UniValue& UniValue::find_value(std::string_view key) const
240
return NullUniValue;
241
}
242
243
+void UniValue::reserve(size_t new_cap)
244
+{
245
+ values.reserve(new_cap);
246
+ if (typ == VOBJ) {
247
+ keys.reserve(new_cap);
248
+ }
249
+}
0 commit comments