mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Remove SparseOHArray::erase
This commit is contained in:
parent
6295da436f
commit
1c85e7ece4
@ -284,7 +284,20 @@ QPDF_Array::erase(int at)
|
||||
return false;
|
||||
}
|
||||
if (sparse) {
|
||||
sp_elements.erase(at);
|
||||
auto end = sp_elements.elements.end();
|
||||
if (auto iter = sp_elements.elements.lower_bound(at); iter != end) {
|
||||
if (iter->first == at) {
|
||||
iter++;
|
||||
sp_elements.elements.erase(at);
|
||||
}
|
||||
|
||||
while (iter != end) {
|
||||
auto nh = sp_elements.elements.extract(iter++);
|
||||
--nh.key();
|
||||
sp_elements.elements.insert(std::move(nh));
|
||||
}
|
||||
}
|
||||
--sp_elements.n_elements;
|
||||
} else {
|
||||
elements.erase(elements.cbegin() + at);
|
||||
}
|
||||
|
@ -30,25 +30,6 @@ SparseOHArray::disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SparseOHArray::erase(int at)
|
||||
{
|
||||
auto end = elements.end();
|
||||
if (auto iter = elements.lower_bound(at); iter != end) {
|
||||
if (iter->first == at) {
|
||||
iter++;
|
||||
elements.erase(at);
|
||||
}
|
||||
|
||||
while (iter != end) {
|
||||
auto nh = elements.extract(iter++);
|
||||
--nh.key();
|
||||
elements.insert(std::move(nh));
|
||||
}
|
||||
}
|
||||
--n_elements;
|
||||
}
|
||||
|
||||
SparseOHArray
|
||||
SparseOHArray::copy()
|
||||
{
|
||||
|
@ -33,7 +33,6 @@ class SparseOHArray
|
||||
{
|
||||
elements[idx] = oh.getObj();
|
||||
}
|
||||
void erase(int idx);
|
||||
SparseOHArray copy();
|
||||
void disconnect();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user