util/AllocatedArray: use std::exchange()
This commit is contained in:
parent
a684b4fff1
commit
f8d7bc1c34
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 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:
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user