1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-28 02:50:34 +00:00

Fix instances of Clang's -Wunqualified-std-cast-call

This commit is contained in:
Arthur O'Dwyer 2022-07-05 12:16:22 -04:00
parent 2d619d2f7c
commit 85753d240f

View File

@ -26,25 +26,24 @@ struct gamedata {
if(ssize & 7) ssize = (ssize | 7) + 1; if(ssize & 7) ssize = (ssize | 7) + 1;
if(mode == 0) { if(mode == 0) {
record.resize(index+ssize); record.resize(index+ssize);
T& at = *(new (&record[index]) T()); ::new (&record[index]) T(std::move(x));
at = move(x);
} }
else { else {
T& at = (T&) record[index]; T& at = (T&) record[index];
x = move(at); x = std::move(at);
at.~T(); at.~T();
} }
index += ssize; index += ssize;
} }
template<class T> void store_ptr(T& x) { template<class T> void store_ptr(T& x) {
T* copy;
if(mode == 0) { if(mode == 0) {
copy = new T; T* copy = new T(std::move(x));
*copy = move(x);
}
store(copy); store(copy);
if(mode != 0) { }
x = move(*copy); else {
T* copy = nullptr;
store(copy);
x = std::move(*copy);
delete copy; delete copy;
} }
} }