vcpkg/ports/boost-json/0001-json-array-erase-relocate.patch

21 lines
573 B
Diff
Raw Normal View History

include/boost/json/impl/array.ipp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/boost/json/impl/array.ipp b/include/boost/json/impl/array.ipp
index 4d067fb..a2c7fd6 100644
--- a/include/boost/json/impl/array.ipp
+++ b/include/boost/json/impl/array.ipp
@@ -491,8 +491,11 @@ erase(
auto const p = &(*t_)[0] +
(pos - &(*t_)[0]);
destroy(p, p + 1);
- relocate(p, p + 1, 1);
--t_->size;
+ if(t_->size > 0)
+ relocate(p, p + 1,
+ t_->size - (p -
+ &(*t_)[0]));
return p;
}