[ox/std] Deprecate ox::move

This commit is contained in:
Gary Talent 2021-12-01 02:55:24 -06:00
parent e0364925a3
commit 37664ede05
18 changed files with 36 additions and 32 deletions

View File

@ -63,7 +63,7 @@ template<typename T>
Result<T> readClaw(const char *buff, std::size_t buffLen) {
T val;
oxReturnError(readClaw(buff, buffLen, &val));
return move(val);
return std::move(val);
}
template<typename T>

View File

@ -77,7 +77,7 @@ Result<String> writeClawHeader(T *t, ClawFormat fmt) noexcept {
out += tn;
}
out += ";";
return move(out);
return std::move(out);
}
}
@ -89,7 +89,7 @@ Result<Buffer> writeClaw(T *t, ClawFormat fmt) {
Buffer out(header.len() + data.size());
memcpy(out.data(), header.data(), header.len());
memcpy(out.data() + header.len(), data.data(), data.size());
return move(out);
return std::move(out);
}
}

View File

@ -17,7 +17,7 @@ FileAddress::FileAddress(const FileAddress &other) noexcept {
}
FileAddress::FileAddress(FileAddress &&other) noexcept {
operator=(move(other));
operator=(std::move(other));
}
FileAddress::FileAddress(std::nullptr_t) noexcept {

View File

@ -41,7 +41,7 @@ Result<Buffer> FileSystem::read(const FileAddress &addr) noexcept {
oxRequire(s, stat(addr));
Buffer buff(s.size);
oxReturnError(read(addr, buff.data(), buff.size()));
return ox::move(buff);
return buff;
}
Error FileSystem::read(const FileAddress &addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) noexcept {

View File

@ -279,7 +279,7 @@ Result<Vector<String>> FileSystemTemplate<FileStore, Directory>::ls(const char *
out.emplace_back(name);
return OxError(0);
}));
return ox::move(out);
return out;
}
template<typename FileStore, typename Directory>

View File

@ -103,7 +103,7 @@ Result<Vector<String>> PassThroughFS::ls(const char *dir) noexcept {
const auto u8p = p.path().filename().u8string();
out.emplace_back(reinterpret_cast<const char*>(u8p.c_str()));
}
return ox::move(out);
return std::move(out);
}
Error PassThroughFS::remove(const char *path, bool recursive) noexcept {

View File

@ -231,7 +231,7 @@ Result<Buffer> writeMC(T *val) noexcept {
MetalClawWriter writer(reinterpret_cast<uint8_t*>(buff.data()), buff.size());
oxReturnError(model(&writer, val));
buff.resize(writer.size());
return move(buff);
return std::move(buff);
}
template<typename T>

View File

@ -92,13 +92,13 @@ struct DescriptorField {
}
const DescriptorField &operator=(DescriptorField &&other) noexcept {
type = move(other.type);
type = std::move(other.type);
other.type = {};
fieldName = move(other.fieldName);
subscriptLevels = move(other.subscriptLevels);
fieldName = std::move(other.fieldName);
subscriptLevels = std::move(other.subscriptLevels);
other.subscriptLevels = {};
typeName = move(other.typeName);
ownsType = move(other.ownsType);
typeName = std::move(other.typeName);
ownsType = std::move(other.ownsType);
other.ownsType = {};
return *this;
}

View File

@ -216,7 +216,7 @@ template<typename T>
Result<Buffer> writeTypeDef(T *val) noexcept {
Buffer buff(units::MB);
oxReturnError(writeTypeDef(buff.data(), buff.size(), val));
return move(buff);
return std::move(buff);
}
}

View File

@ -138,7 +138,7 @@ class Mover {
} else {
auto &src = *v;
auto &dst = *cbit_cast<FT*>(m_dst->vars[m_i]);
dst = move(src);
dst = std::move(src);
src = FT{};
++m_i;
return OxError(0);
@ -150,7 +150,7 @@ class Mover {
for (auto i = 0l; i < elements; ++i) {
auto &src = list[i];
auto &dst = cbit_cast<FT*>(m_dst->vars[m_i])[i];
dst = move(src);
dst = std::move(src);
src = FT{};
}
++m_i;
@ -161,7 +161,7 @@ class Mover {
constexpr Error field(const char*, UnionView<U> u) noexcept {
auto &dst = *cbit_cast<U*>(m_dst->vars[m_i]);
auto &src = *u.get();
dst = move(src);
dst = std::move(src);
++m_i;
return OxError(0);
}

View File

@ -228,7 +228,7 @@ template<typename T>
Result<T> readOC(const char *json, std::size_t jsonLen) noexcept {
T val;
oxReturnError(readOC(json, jsonLen, &val));
return move(val);
return std::move(val);
}
template<typename T>

View File

@ -154,7 +154,7 @@ Result<Buffer> writeOC(T *val) noexcept {
const auto str = Json::writeString(jsonBuilder, writer.m_json);
Buffer buff(str.size() + 1);
memcpy(buff.data(), str.c_str(), str.size() + 1);
return move(buff);
return std::move(buff);
}
}

View File

@ -99,8 +99,8 @@ HashMap<K, T>::HashMap(const HashMap<K, T> &other) {
template<typename K, typename T>
HashMap<K, T>::HashMap(HashMap<K, T> &&other) {
m_keys = move(other.m_keys);
m_pairs = move(other.m_pairs);
m_keys = std::move(other.m_keys);
m_pairs = std::move(other.m_pairs);
}
template<typename K, typename T>
@ -136,8 +136,8 @@ template<typename K, typename T>
HashMap<K, T> &HashMap<K, T>::operator=(HashMap<K, T> &&other) {
if (this != &other) {
clear();
m_keys = move(other.m_keys);
m_pairs = move(other.m_pairs);
m_keys = std::move(other.m_keys);
m_pairs = std::move(other.m_pairs);
}
return *this;
}

View File

@ -87,7 +87,7 @@ class UniquePtr {
template<typename U>
constexpr UniquePtr &operator=(UniquePtr<U> &&other) {
reset(move(other));
reset(std::move(other));
return *this;
}

View File

@ -45,7 +45,7 @@ static auto symbolicate([[maybe_unused]]char **frames,
out.emplace_back(sfmt<StrT>("{}", frames[i]));
}
#endif // __has_include(<cxxabi.h>)
return move(out);
return out;
}
#endif // defined(OX_USE_STDLIB) && __has_include(<unistd.h>)

View File

@ -305,7 +305,7 @@ BasicString<SmallStringSize> &BasicString<SmallStringSize>::operator=(const Basi
template<std::size_t SmallStringSize>
BasicString<SmallStringSize> &BasicString<SmallStringSize>::operator=(BasicString &&src) noexcept {
m_buff = move(src.m_buff);
m_buff = std::move(src.m_buff);
return *this;
}
@ -361,7 +361,7 @@ BasicString<SmallStringSize> BasicString<SmallStringSize>::operator+(const char
memcpy(&cpy.m_buff[currentLen], str, strLen);
// make sure last element is a null terminator
cpy.m_buff[currentLen + strLen] = 0;
return move(cpy);
return cpy;
}
template<std::size_t SmallStringSize>
@ -461,7 +461,7 @@ BasicString<SmallStringSize> BasicString<SmallStringSize>::substr(std::size_t be
const auto buff = out.data();
memcpy(buff, src, size);
buff[size] = 0;
return move(out);
return out;
}
template<std::size_t SmallStringSize>

View File

@ -23,17 +23,21 @@ constexpr T &&forward(remove_reference_t<T> &&t) noexcept {
}
template<typename T>
[[deprecated]]
constexpr typename remove_reference<T>::type &&move(T &&t) noexcept {
return static_cast<typename remove_reference<T>::type&&>(t);
}
}
#if !__has_include(<utility>)
#if __has_include(<utility>)
#include <utility>
#else
namespace std {
template<typename T>
constexpr typename ox::remove_reference<T>::type &&move(T &&t) noexcept {
return static_cast<typename ox::remove_reference<T>::type&&>(t);
}
}
#endif
#endif

View File

@ -540,7 +540,7 @@ constexpr void Vector<T, SmallVectorSize>::insert(std::size_t pos, const T &val)
expandCap(m_cap ? m_cap * 2 : 100);
}
for (auto i = m_size; i > pos; --i) {
new (&m_items[i]) T(move(m_items[i - 1]));
new (&m_items[i]) T(std::move(m_items[i - 1]));
}
m_items[pos] = val;
++m_size;
@ -595,7 +595,7 @@ constexpr Error Vector<T, SmallVectorSize>::unordered_erase(std::size_t pos) {
return OxError(1);
}
--m_size;
m_items[pos] = move(m_items[m_size]);
m_items[pos] = std::move(m_items[m_size]);
return OxError(0);
}