Commit f8d7bc1c authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

util/AllocatedArray: use std::exchange()

parent a684b4ff
/* /*
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com> * Copyright 2010-2019 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -71,9 +71,7 @@ public: ...@@ -71,9 +71,7 @@ public:
} }
AllocatedArray(AllocatedArray &&other) noexcept AllocatedArray(AllocatedArray &&other) noexcept
:buffer(other.buffer) { :buffer(std::exchange(other.buffer, nullptr)) {}
other.buffer = nullptr;
}
~AllocatedArray() noexcept { ~AllocatedArray() noexcept {
delete[] buffer.data; delete[] buffer.data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment