packages/libs/boost/patches/910-json-array-erase-relocate.patch
Carlos Miguel Ferreira 70b7dc87d4 boost: Updates package to version 1.79.0
This commit updates boost to version 1.79.0

There are no new libraries in this version

More info about Boost 1.79.0 can be found at the usual place [1].

Note: This package update includes a fix merged to Boost.JSON in [2]
which did not make into this version.

[1]: https://www.boost.org/users/history/version_1_79_0.html
[2]: https://github.com/boostorg/json/issues/692

Signed-off-by: Carlos Miguel Ferreira <carlosmf.pt@gmail.com>
2022-04-27 12:43:59 -07:00

47 lines
923 B
Diff

--- a/boost/json/impl/array.ipp
+++ b/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;
}
--- a/libs/json/test/array.cpp
+++ b/libs/json/test/array.cpp
@@ -1270,6 +1270,21 @@ public:
}
void
+ testIssue692()
+ {
+ array a;
+ object obj;
+ obj["test1"] = "hello";
+ a.push_back(obj);
+ a.push_back(obj);
+ a.push_back(obj);
+ a.push_back(obj);
+ a.push_back(obj);
+ while(a.size())
+ a.erase(a.begin());
+ }
+
+ void
run()
{
testDestroy();
@@ -1283,6 +1298,7 @@ public:
testExceptions();
testEquality();
testHash();
+ testIssue692();
}
};