MCPcopy Create free account
hub / github.com/couchbase/fleece / insert

Method insert

Fleece/Integration/MArray.hh:92–103  ·  view source on GitHub ↗

Inserts the value `val` into the array at index `i`, or returns false if the array is out of range (greater than the count.) */

Source from the content-addressed store, hash-verified

90 /** Inserts the value `val` into the array at index `i`,
91 or returns false if the array is out of range (greater than the count.) */
92 bool insert(size_t i, Native val) {
93 if (_usuallyFalse(!MCollection::isMutable()))
94 return false;
95 size_t cnt = count();
96 if (_usuallyFalse(i > cnt || val == nullptr))
97 return false;
98 else if (i < cnt)
99 populateVec();
100 MCollection::mutate();
101 _vec.emplace(_vec.begin() + i, val);
102 return true;
103 }
104
105 bool append(Native val) {
106 return insert(count(), val);

Callers

nothing calls this directly

Calls 1

beginMethod · 0.45

Tested by

no test coverage detected