BloombergLP::bdljsn::JsonObject::insert

Move-insert the specified member if its key is not already present.

Synopsis

Declared in <bdljsn_json.h>

bsl::pair<JsonObject::Iterator, bool>
insert(bslmf::MovableRef<Member> member);

Description

Insert the specified member into this JsonObject if the key (the first element) of the object referred to by member does not already exist in this JsonObject; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) member object in this JsonObject whose key is the equivalent to that of the object to be inserted, and whose second member is true if a new value was inserted, and false otherwise. The behavior is undefined unless member.first is valid UTF-8 (see bdlde::Utf8Util::isValid).

Return Value

a pair of an iterator to the element and a bool that is true if inserted

Parameters

NameDescription
memberkey/value pair to insert