Skip to content

Commit 90244e2

Browse files
author
Fabien Servant
committed
Upgrade for Cpp20
1 parent a2f2817 commit 90244e2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lemon/bits/array_map.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace lemon {
8888
Item it;
8989
for (nf->first(it); it != INVALID; nf->next(it)) {
9090
int id = nf->id(it);;
91-
allocator.construct(&(values[id]), Value());
91+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), Value());
9292
}
9393
}
9494

@@ -102,7 +102,7 @@ namespace lemon {
102102
Item it;
103103
for (nf->first(it); it != INVALID; nf->next(it)) {
104104
int id = nf->id(it);;
105-
allocator.construct(&(values[id]), value);
105+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), value);
106106
}
107107
}
108108

@@ -121,7 +121,7 @@ namespace lemon {
121121
Item it;
122122
for (nf->first(it); it != INVALID; nf->next(it)) {
123123
int id = nf->id(it);;
124-
allocator.construct(&(values[id]), copy.values[id]);
124+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), copy.values[id]);
125125
}
126126
}
127127

@@ -218,15 +218,15 @@ namespace lemon {
218218
for (nf->first(it); it != INVALID; nf->next(it)) {
219219
int jd = nf->id(it);;
220220
if (id != jd) {
221-
allocator.construct(&(new_values[jd]), values[jd]);
222-
allocator.destroy(&(values[jd]));
221+
std::allocator_traits<Allocator>::construct(allocator, &(new_values[jd]), values[jd]);
222+
std::allocator_traits<Allocator>::destroy(allocator, &(values[jd]));
223223
}
224224
}
225225
if (capacity != 0) allocator.deallocate(values, capacity);
226226
values = new_values;
227227
capacity = new_capacity;
228228
}
229-
allocator.construct(&(values[id]), Value());
229+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), Value());
230230
}
231231

232232
// \brief Adds more new keys to the map.
@@ -260,16 +260,16 @@ namespace lemon {
260260
}
261261
}
262262
if (found) continue;
263-
allocator.construct(&(new_values[id]), values[id]);
264-
allocator.destroy(&(values[id]));
263+
std::allocator_traits<Allocator>::construct(allocator, &(new_values[id]), values[id]);
264+
std::allocator_traits<Allocator>::destroy(allocator, &(values[id]));
265265
}
266266
if (capacity != 0) allocator.deallocate(values, capacity);
267267
values = new_values;
268268
capacity = new_capacity;
269269
}
270270
for (int i = 0; i < int(keys.size()); ++i) {
271271
int id = nf->id(keys[i]);
272-
allocator.construct(&(values[id]), Value());
272+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), Value());
273273
}
274274
}
275275

@@ -279,7 +279,7 @@ namespace lemon {
279279
// and it overrides the erase() member function of the observer base.
280280
virtual void erase(const Key& key) {
281281
int id = Parent::notifier()->id(key);
282-
allocator.destroy(&(values[id]));
282+
std::allocator_traits<Allocator>::destroy(allocator, &(values[id]));
283283
}
284284

285285
// \brief Erase more keys from the map.
@@ -289,7 +289,7 @@ namespace lemon {
289289
virtual void erase(const std::vector<Key>& keys) {
290290
for (int i = 0; i < int(keys.size()); ++i) {
291291
int id = Parent::notifier()->id(keys[i]);
292-
allocator.destroy(&(values[id]));
292+
std::allocator_traits<Allocator>::destroy(allocator, &(values[id]));
293293
}
294294
}
295295

@@ -303,7 +303,7 @@ namespace lemon {
303303
Item it;
304304
for (nf->first(it); it != INVALID; nf->next(it)) {
305305
int id = nf->id(it);;
306-
allocator.construct(&(values[id]), Value());
306+
std::allocator_traits<Allocator>::construct(allocator, &(values[id]), Value());
307307
}
308308
}
309309

@@ -317,7 +317,7 @@ namespace lemon {
317317
Item it;
318318
for (nf->first(it); it != INVALID; nf->next(it)) {
319319
int id = nf->id(it);
320-
allocator.destroy(&(values[id]));
320+
std::allocator_traits<Allocator>::destroy(allocator, &(values[id]));
321321
}
322322
allocator.deallocate(values, capacity);
323323
capacity = 0;

0 commit comments

Comments
 (0)