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
1 changed files with 8 additions and 9 deletions

View File

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