File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,23 @@ Json::Value obj_value(Json::objectValue); // {}
347
347
// / Return isNull()
348
348
bool operator !() const ;
349
349
350
+ /* * \brief Return ! isNull();
351
+ *
352
+ * Example of usage:
353
+ * \code
354
+ * Json::Value root;
355
+ * std::cin >> root;
356
+ *
357
+ * if (auto tag = root["tag"]) {
358
+ * // Behavior if tag object with tag key exist
359
+ * } else {
360
+ * // Behavior if tag object with tag key absent
361
+ * }
362
+ * \endcode
363
+ *
364
+ */
365
+ explicit operator bool () const ;
366
+
350
367
// / Remove all object members and array elements.
351
368
// / \pre type() is arrayValue, objectValue, or nullValue
352
369
// / \post type() is unchanged
Original file line number Diff line number Diff line change @@ -883,6 +883,8 @@ bool Value::empty() const {
883
883
884
884
bool Value::operator !() const { return isNull (); }
885
885
886
+ Value::operator bool () const { return ! isNull (); }
887
+
886
888
void Value::clear () {
887
889
JSON_ASSERT_MESSAGE (type_ == nullValue || type_ == arrayValue ||
888
890
type_ == objectValue,
You can’t perform that action at this time.
0 commit comments