Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace alloc.destroy with std::allocator_traits<std::allocator<T>>::… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lemon/bits/array_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ namespace lemon {
int jd = nf->id(it);;
if (id != jd) {
allocator.construct(&(new_values[jd]), values[jd]);
allocator.destroy(&(values[jd]));
std::allocator_traits<std::allocator<Value>>::destroy(allocator, &(values[jd]));
}
}
if (capacity != 0) allocator.deallocate(values, capacity);
Expand Down Expand Up @@ -261,7 +261,7 @@ namespace lemon {
}
if (found) continue;
allocator.construct(&(new_values[id]), values[id]);
allocator.destroy(&(values[id]));
std::allocator_traits<std::allocator<Value>>::destroy(allocator, &(values[id]));
}
if (capacity != 0) allocator.deallocate(values, capacity);
values = new_values;
Expand All @@ -279,7 +279,7 @@ namespace lemon {
// and it overrides the erase() member function of the observer base.
virtual void erase(const Key& key) {
int id = Parent::notifier()->id(key);
allocator.destroy(&(values[id]));
std::allocator_traits<std::allocator<Value>>::destroy(allocator, &(values[id]));
}

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

Expand Down Expand Up @@ -317,7 +317,7 @@ namespace lemon {
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);
allocator.destroy(&(values[id]));
std::allocator_traits<std::allocator<Value>>::destroy(allocator, &(values[id]));
}
allocator.deallocate(values, capacity);
capacity = 0;
Expand Down
6 changes: 3 additions & 3 deletions lemon/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ namespace lemon {
void clear() {
while (first != 0) {
last = first->next;
alloc.destroy(first);
std::allocator_traits<std::allocator<Node>>::destroy(alloc, first);
alloc.deallocate(first, 1);
first = last;
}
Expand Down Expand Up @@ -698,7 +698,7 @@ namespace lemon {
} else {
last = 0;
}
alloc.destroy(node);
std::allocator_traits<std::allocator<Node>>::destroy(alloc, node);
alloc.deallocate(node, 1);
}

Expand Down Expand Up @@ -731,7 +731,7 @@ namespace lemon {
} else {
first = 0;
}
alloc.destroy(node);
std::allocator_traits<std::allocator<Node>>::destroy(alloc, node);
alloc.deallocate(node, 1);
}

Expand Down