mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-28 20:15:24 +08:00
Merge pull request #804 from yantaozhao/master
allow nullptr when not care the removed array value
This commit is contained in:
commit
2baad4923e
@ -562,7 +562,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/** \brief Remove the indexed array element.
|
/** \brief Remove the indexed array element.
|
||||||
|
|
||||||
O(n) expensive operations.
|
O(n) expensive operations.
|
||||||
Update 'removed' if removed.
|
Update 'removed' iff removed.
|
||||||
\return true if removed (no exceptions)
|
\return true if removed (no exceptions)
|
||||||
*/
|
*/
|
||||||
bool removeIndex(ArrayIndex index, Value* removed);
|
bool removeIndex(ArrayIndex index, Value* removed);
|
||||||
|
@ -1243,7 +1243,8 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
|||||||
if (it == value_.map_->end()) {
|
if (it == value_.map_->end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*removed = it->second;
|
if (removed)
|
||||||
|
*removed = it->second;
|
||||||
ArrayIndex oldSize = size();
|
ArrayIndex oldSize = size();
|
||||||
// shift left all items left, into the place of the "removed"
|
// shift left all items left, into the place of the "removed"
|
||||||
for (ArrayIndex i = index; i < (oldSize - 1); ++i) {
|
for (ArrayIndex i = index; i < (oldSize - 1); ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user