[ox] Remove std::move calls that suppressed copy elision

This commit is contained in:
Gary Talent 2021-12-01 19:55:09 -06:00
parent 37664ede05
commit 163fcf1785
6 changed files with 8 additions and 12 deletions

View File

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

View File

@ -103,7 +103,7 @@ Result<Vector<String>> PassThroughFS::ls(const char *dir) noexcept {
const auto u8p = p.path().filename().u8string(); const auto u8p = p.path().filename().u8string();
out.emplace_back(reinterpret_cast<const char*>(u8p.c_str())); out.emplace_back(reinterpret_cast<const char*>(u8p.c_str()));
} }
return std::move(out); return out;
} }
Error PassThroughFS::remove(const char *path, bool recursive) noexcept { 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()); MetalClawWriter writer(reinterpret_cast<uint8_t*>(buff.data()), buff.size());
oxReturnError(model(&writer, val)); oxReturnError(model(&writer, val));
buff.resize(writer.size()); buff.resize(writer.size());
return std::move(buff); return buff;
} }
template<typename T> template<typename T>

View File

@ -22,16 +22,14 @@
#include "typenamecatcher.hpp" #include "typenamecatcher.hpp"
#include "types.hpp" #include "types.hpp"
namespace ox { namespace ox::detail {
namespace detail {
template<bool> template<bool>
struct BoolWrapper { struct BoolWrapper {
}; };
template<typename T, typename = BoolWrapper<true>> template<typename T, typename = BoolWrapper<true>>
struct preloadable : false_type { struct preloadable: false_type {
}; };
template<typename T> template<typename T>
@ -58,6 +56,4 @@ struct preloadable<T, BoolWrapper<T::Preloadable>> {
// static constexpr const char *value = T::TypeName; // static constexpr const char *value = T::TypeName;
//}; //};
}
} }

View File

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

View File

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