Skip to content

Commit

Permalink
Fixed unqualified calls to std::move
Browse files Browse the repository at this point in the history
  • Loading branch information
nadult committed Nov 26, 2023
1 parent 5525a2c commit 5abeb51
Show file tree
Hide file tree
Showing 50 changed files with 141 additions and 132 deletions.
1 change: 0 additions & 1 deletion include/fwk/sys_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@

namespace fwk {

using std::move;
using std::string;
using std::swap;
using string32 = std::u32string;
Expand Down
4 changes: 2 additions & 2 deletions src/any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace detail {
Any::Any() = default;
Any::Any(Ex<Any> &&rhs) {
if(rhs)
*this = move(*rhs);
*this = std::move(*rhs);
else
*this = move(rhs.error());
*this = std::move(rhs.error());
}
Any::Any(const Ex<Any> &rhs) {
if(rhs)
Expand Down
6 changes: 3 additions & 3 deletions src/any_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Ex<AnyConfig> AnyConfig::load(CXmlNode node, bool ignore_errors) {
ZStr name = sub_node.name();
auto value = Any::load(sub_node);
if(value)
out.m_elements.emplace(name, move(*value));
out.m_elements.emplace(name, std::move(*value));
else
out.m_loading_errors.emplace_back(name, value.error());
sub_node = sub_node.sibling();
Expand All @@ -28,7 +28,7 @@ Ex<AnyConfig> AnyConfig::load(CXmlNode node, bool ignore_errors) {

if(!ignore_errors && out.m_loading_errors) {
vector<Error> errors = transform(out.m_loading_errors, [](auto p) { return p.second; });
return Error::merge(move(errors));
return Error::merge(std::move(errors));
}

return out;
Expand All @@ -47,7 +47,7 @@ const Any *AnyConfig::get(Str name) const {

const AnyConfig *AnyConfig::subConfig(Str name) const { return get<AnyConfig>(name); }

void AnyConfig::set(string name, Any value) { m_elements[name] = move(value); }
void AnyConfig::set(string name, Any value) { m_elements[name] = std::move(value); }

vector<string> AnyConfig::keys() const { return m_elements.keys(); }

Expand Down
2 changes: 1 addition & 1 deletion src/audio/ogg_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ Sound OggStream::makeSound() const {
}

printf("Sound %s: %dKB\n", m_file_name.c_str(), (int)data.size() / 1024);
return Sound(move(data), info);
return Sound(std::move(data), info);
}
}
2 changes: 1 addition & 1 deletion src/audio/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Ex<Sound> Sound::load(FileStream &sr) {

vector<char> data(size);
sr.loadData(data);
return Sound(move(data), {(int)frequency, bits, channels > 1});
return Sound(std::move(data), {(int)frequency, bits, channels > 1});
}

Ex<> Sound::save(FileStream &sr) const {
Expand Down
4 changes: 2 additions & 2 deletions src/geom/contour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ template <class T> Contour<T> Contour<T>::smooth(Scalar step) const {
}
int end = m_points.size() - 1;
out.emplace_back(interpCatmullRom(temp[end], temp[end + 1], temp[end + 2], temp[end + 3], 1.0));
return {move(out), isLooped()};
return {std::move(out), isLooped()};
}

template <class T> Contour<T> Contour<T>::blur(int width) const {
Expand Down Expand Up @@ -465,7 +465,7 @@ template <class T> Contour<T> Contour<T>::blur(int width) const {
out.back() = m_points.back();
}

return {move(out), isLooped()};
return {std::move(out), isLooped()};
}

template <class T>
Expand Down
6 changes: 3 additions & 3 deletions src/geom/geom_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ template <class T> GeomGraph<T>::GeomGraph(vector<Point> points) {

template <class T>
GeomGraph<T>::GeomGraph(Graph graph, PodVector<Point> points, PointMap point_map)
: Graph(move(graph)), m_points(move(points)), m_point_map(move(point_map)) {}
: Graph(std::move(graph)), m_points(std::move(points)), m_point_map(std::move(point_map)) {}

template <class T>
GeomGraph<T>::GeomGraph(const Graph &graph, PodVector<Point> points, PointMap point_map,
CSpan<Pair<VertexId>> collapsed_verts)
: m_points(move(points)), m_point_map(move(point_map)) {
: m_points(std::move(points)), m_point_map(std::move(point_map)) {
vector<Maybe<VertexId>> collapses(graph.vertsSpread());
for(auto [from, to] : collapsed_verts)
collapses[from] = to;
Expand Down Expand Up @@ -346,7 +346,7 @@ template <class T> auto GeomGraph<T>::makeGrid() const -> Grid {
return {edgePairs(), points()};
else {
auto flat_points = flatten<Point>(points(), m_flat_axes);
return {edgePairs(), move(flat_points), m_verts.valids(), m_verts.size()};
return {edgePairs(), std::move(flat_points), m_verts.valids(), m_verts.size()};
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/geom/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ FixedElem<TriId> Graph::fixTri(VertexId v1, VertexId v2, VertexId v3, Layer laye
}

void Graph::remove(VertexId vid) {
auto edges = move(m_verts[vid]);
auto edges = std::move(m_verts[vid]);
for(auto eid : edges)
remove(eid);
if(m_vert_tris.size() > vid)
Expand Down Expand Up @@ -358,7 +358,7 @@ Graph Graph::makeForest(CSpan<Maybe<VertexId>> parents) {
for(auto node_id : indexRange<VertexId>(parents))
if(parents[node_id])
edges.emplace_back(*parents[node_id], node_id);
return {move(edges)};
return {std::move(edges)};
}

bool Graph::isUndirected(Layers layers) const {
Expand Down Expand Up @@ -571,7 +571,7 @@ vector<VertexId> Graph::topoSort(bool inverse, Layers layers) const {
for(auto vid : vertexIds())
if(!context.visited[vid])
topoSort(context, vid);
return move(context.out);
return std::move(context.out);
}

// TODO: is this really needed ?
Expand Down
2 changes: 1 addition & 1 deletion src/geom/segment_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ SegmentGrid<T>::SegmentGrid(SparseSpan<Pair<VertexId>> edges, SparseSpan<Point>
template <class T>
SegmentGrid<T>::SegmentGrid(SparseSpan<Pair<VertexId>> edges, PodVector<Point> points,
CSpan<bool> valids, int psize)
: m_points_buffer(move(points)) {
: m_points_buffer(std::move(points)) {
SparseSpan<Point> pspan(m_points_buffer.data(), valids, psize);
initialize(edges, pspan);
}
Expand Down
2 changes: 1 addition & 1 deletion src/geom/voronoi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace fwk {

Voronoi::Voronoi(GeomGraph<double2> graph, vector<Cell> cells)
: graph(move(graph)), cells(move(cells)) {
: graph(std::move(graph)), cells(std::move(cells)) {
for(auto &cell : cells) {
if(EdgeId *eid = cell)
DASSERT(graph.valid(*eid));
Expand Down
4 changes: 2 additions & 2 deletions src/geom/voronoi_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DelaunayConstructor {
builder.construct(this);
}

vector<Pair<VertexId>> extractSitePairs() { return move(m_site_pairs); }
vector<Pair<VertexId>> extractSitePairs() { return std::move(m_site_pairs); }

void clear() { m_site_pairs.clear(); }
void _reserve(std::size_t num_sites) { m_site_pairs.reserve(num_sites * 3); }
Expand Down Expand Up @@ -297,7 +297,7 @@ class VoronoiConstructor {
}
}

return {move(out), move(cells)};
return {std::move(out), std::move(cells)};
}

void clip_infinite_edge(const edge_type &edge, vector<double2> &out) const {
Expand Down
2 changes: 1 addition & 1 deletion src/gfx/animated_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AnimatedModel::AnimatedModel(const Model &model, const Pose &pose) : m_model(mod
anim_data = mesh->animate(skinning_pose);
}

m_meshes.emplace_back(node.mesh_id, move(anim_data), transforms[node.id]);
m_meshes.emplace_back(node.mesh_id, std::move(anim_data), transforms[node.id]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gfx/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Ex<string> Converter::exportFromBlender(const string &file_name, string &target_

Ex<Pair<Model, string>> Converter::loadModel(FileType file_type, ZStr file_name) {
if(file_type == FileType::fwk_model) {
auto doc = move(XmlDocument::load(file_name).get());
auto doc = std::move(XmlDocument::load(file_name).get());
XmlOnFailGuard xml_guard(doc);
XmlNode child = doc.child();
if(!child)
Expand Down
4 changes: 2 additions & 2 deletions src/gfx/drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Ex<vector<PVPipeline>> SimpleDrawCall::makePipelines(ShaderCompiler &compiler, V
auto pipeline = EX_PASS(device.getCachedPipeline(compiler, makePipeline, render_pass,
setup.blending_mode, setup.flags,
setup.primitive_topo));
pipelines.emplace_back(move(pipeline));
pipelines.emplace_back(std::move(pipeline));
}
return pipelines;
}
Expand Down Expand Up @@ -182,7 +182,7 @@ Ex<SimpleVertexArray> SimpleVertexArray::make(VulkanDevice &device, CSpan<Colore
SimpleDrawCall::SimpleDrawCall(SimpleVertexArray vertex_array, const SimpleMaterial &material,
Matrix4 matrix, Maybe<FBox> transformed_bbox)
: matrix(matrix), transformed_bbox(transformed_bbox), material(material),
vertex_array(move(vertex_array)) {}
vertex_array(std::move(vertex_array)) {}
FWK_COPYABLE_CLASS_IMPL(SimpleDrawCall);*/

Expand Down
4 changes: 2 additions & 2 deletions src/gfx/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ i64 FontCore::usedMemory() const { return m_glyphs.usedMemory() + m_kernings.use
}
// clang-format on

Font::Font(FontCore core, PVImageView texture) : m_core(move(core)), m_texture(texture) {
Font::Font(FontCore core, PVImageView texture) : m_core(std::move(core)), m_texture(texture) {
DASSERT(m_texture);
DASSERT_EQ(int3(core.m_texture_size, 1), m_texture->size());
}
Expand All @@ -230,7 +230,7 @@ Ex<Font> Font::makeDefault(VDeviceRef device, VWindowRef window, int font_size)
auto font_data = EX_PASS(FontFactory().makeFont(font_path, font_size));
auto font_image = EX_PASS(VulkanImage::createAndUpload(device, font_data.image));
auto font_image_view = VulkanImageView::create(device, font_image);
return Font(move(font_data.core), move(font_image_view));
return Font(std::move(font_data.core), std::move(font_image_view));
}

float2 Font::drawPos(const string32 &text, const FRect &rect, const FontStyle &style) const {
Expand Down
6 changes: 3 additions & 3 deletions src/gfx/font_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ auto FontFactory::makeFont(ZStr path, const string32 &charset, int size_px, bool

glyphs.emplace_back(
FontCore::Glyph{(int)character, {0, 0}, (short2)tex.size(), bearing, advance},
move(tex));
std::move(tex));
}

auto atlas = makeTextureAtlas(glyphs);
Expand All @@ -198,7 +198,7 @@ auto FontFactory::makeFont(ZStr path, const string32 &charset, int size_px, bool
}

int line_height = (int)face->size->metrics.height / 64;
FontCore core{move(oglyphs), move(okernings), atlas.size(), line_height};
return FontData{move(core), move(atlas)};
FontCore core{std::move(oglyphs), std::move(okernings), atlas.size(), line_height};
return FontData{std::move(core), std::move(atlas)};
}
}
2 changes: 1 addition & 1 deletion src/gfx/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Image::Image(PodVector<u8> data, int2 size, VFormat format)
}

Image::Image(Image rhs, VFormat format)
: m_data(move(rhs.m_data)), m_size(rhs.m_size), m_format(format) {
: m_data(std::move(rhs.m_data)), m_size(rhs.m_size), m_format(format) {
rhs.m_size = int2(0, 0);
DASSERT(areCompatible(rhs.m_format, format));
}
Expand Down
24 changes: 13 additions & 11 deletions src/gfx/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
namespace fwk {

Mesh::Mesh(MeshBuffers buffers, vector<MeshIndices> indices, vector<string> material_names)
: m_buffers(move(buffers)), m_indices(move(indices)), m_material_names(move(material_names)) {
: m_buffers(std::move(buffers)), m_indices(std::move(indices)),
m_material_names(std::move(material_names)) {
for(const auto &indices : m_indices)
DASSERT(indices.empty() || indices.indexRange().second < m_buffers.size());
DASSERT(!m_material_names || m_material_names.size() == m_indices.size());
Expand All @@ -37,7 +38,7 @@ Ex<Mesh> Mesh::load(CXmlNode node) {
auto buffers = MeshBuffers::load(node);
if(!buffers)
return buffers.error();
return Mesh{move(buffers.get()), move(indices), move(materials)};
return Mesh{std::move(buffers.get()), std::move(indices), std::move(materials)};
}

void Mesh::saveToXML(XmlNode node) const {
Expand Down Expand Up @@ -127,7 +128,7 @@ vector<Mesh> Mesh::split(int max_vertices) const {
string mat_name = !m_material_names ? "" : m_material_names[n];
for(int i = 0; i < new_indices.size(); i++)
out.emplace_back(
Mesh(m_buffers.remap(mappings[i]), {move(new_indices[i])}, {mat_name}));
Mesh(m_buffers.remap(mappings[i]), {std::move(new_indices[i])}, {mat_name}));
DASSERT(out.back().vertexCount() <= max_vertices);
}

Expand All @@ -142,7 +143,7 @@ Mesh Mesh::merge(vector<Mesh> meshes) {
}

if(meshes.size() == 1)
return move(meshes.front());
return std::move(meshes.front());
if(!meshes)
return Mesh();

Expand Down Expand Up @@ -176,19 +177,20 @@ Mesh Mesh::merge(vector<Mesh> meshes) {
std::copy(begin(mesh.normals()), end(mesh.normals()), begin(out_normals) + offset);

for(int n = 0; n < mesh.indices().size(); n++) {
out_indices.emplace_back(MeshIndices::applyOffset(move(mesh.indices()[n]), offset));
out_indices.emplace_back(
MeshIndices::applyOffset(std::move(mesh.indices()[n]), offset));
out_materials.emplace_back(mesh.materialNames() ? mesh.materialNames()[n] : "");
}

offset += mesh.vertexCount();
}

return Mesh({move(out_positions), move(out_normals), move(out_tex_coords)}, move(out_indices),
move(out_materials));
return Mesh({std::move(out_positions), std::move(out_normals), std::move(out_tex_coords)},
std::move(out_indices), std::move(out_materials));
}

Mesh Mesh::transform(const Matrix4 &mat, Mesh mesh) {
mesh.m_buffers = MeshBuffers::transform(mat, move(mesh.m_buffers));
mesh.m_buffers = MeshBuffers::transform(mat, std::move(mesh.m_buffers));
mesh.m_bounding_box = enclose(mesh.positions());
return mesh;
}
Expand Down Expand Up @@ -235,13 +237,13 @@ Mesh::AnimatedData Mesh::animate(const Pose &pose) const {
auto mapped_pose = m_buffers.mapPose(pose);
auto positions = m_buffers.animatePositions(mapped_pose);
FBox bbox = enclose(positions);
return AnimatedData{bbox, move(positions), m_buffers.animateNormals(mapped_pose)};
return AnimatedData{bbox, std::move(positions), m_buffers.animateNormals(mapped_pose)};
}

Mesh Mesh::apply(Mesh mesh, AnimatedData data) {
if(!data.empty()) {
mesh.m_buffers.positions = move(data.positions);
mesh.m_buffers.normals = move(data.normals);
mesh.m_buffers.positions = std::move(data.positions);
mesh.m_buffers.normals = std::move(data.normals);
mesh.m_bounding_box = data.bounding_box;
}
return mesh;
Expand Down
9 changes: 5 additions & 4 deletions src/gfx/mesh_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ namespace {
MeshBuffers::MeshBuffers(vector<float3> positions, vector<float3> normals,
vector<float2> tex_coords, vector<IColor> colors,
vector<vector<VertexWeight>> weights, vector<string> node_names)
: positions(move(positions)), normals(move(normals)), tex_coords(move(tex_coords)),
colors(move(colors)), weights(move(weights)), node_names(move(node_names)) {
: positions(std::move(positions)), normals(std::move(normals)),
tex_coords(std::move(tex_coords)), colors(std::move(colors)), weights(std::move(weights)),
node_names(std::move(node_names)) {
// TODO: when loading from file, we want to use ASSERT, otherwise DASSERT
// In general if data is marked as untrusted, then we have to check.

Expand Down Expand Up @@ -177,8 +178,8 @@ vector<float3> MeshBuffers::animateNormals(CSpan<Matrix4> matrices) const {
}

MeshBuffers MeshBuffers::transform(const Matrix4 &matrix, MeshBuffers buffers) {
buffers.positions = transformVertices(matrix, move(buffers.positions));
buffers.normals = transformNormals(matrix, move(buffers.normals));
buffers.positions = transformVertices(matrix, std::move(buffers.positions));
buffers.normals = transformNormals(matrix, std::move(buffers.normals));
return buffers;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gfx/mesh_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Mesh Mesh::makeRect(const FRect &xz_rect, float y) {
float3(xz_rect.ex(), y, xz_rect.ey()), float3(xz_rect.x(), y, xz_rect.ey())};
auto normals = vector<float3>(4, float3(0, 1, 0));
auto tex_coords = vector<float2>{{0, 0}, {1, 0}, {1, 1}, {0, 1}};
return Mesh({move(positions), move(normals), move(tex_coords)},
return Mesh({std::move(positions), std::move(normals), std::move(tex_coords)},
{MeshIndices({0, 2, 1, 0, 3, 2})});
}

Expand Down
8 changes: 4 additions & 4 deletions src/gfx/mesh_indices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace fwk {

MeshIndices::MeshIndices(vector<int> indices, Topology topology)
: m_data(move(indices)), m_topology(topology) {
: m_data(std::move(indices)), m_topology(topology) {
DASSERT(isSupported(m_topology));
}

Expand All @@ -18,7 +18,7 @@ MeshIndices MeshIndices::makeRange(int count, int first, Topology ptype) {
DASSERT(count >= 0);
vector<int> indices(count);
std::iota(begin(indices), end(indices), first);
return MeshIndices(move(indices), ptype);
return MeshIndices(std::move(indices), ptype);
}

MeshIndices MeshIndices::merge(const vector<MeshIndices> &set, vector<Pair<int>> &index_ranges) {
Expand Down Expand Up @@ -97,8 +97,8 @@ vector<MeshIndices> MeshIndices::split(int max_vertices, vector<vector<int>> &ou
for(auto idx : mapping)
index_map[idx - range.first] = -1;

out.emplace_back(move(indices));
out_mappings.emplace_back(move(mapping));
out.emplace_back(std::move(indices));
out_mappings.emplace_back(std::move(mapping));
}

return out;
Expand Down
Loading

0 comments on commit 5abeb51

Please sign in to comment.