From 1db42c9b7967507d5d3ac688fb1a4a36bfac5f95 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 12 Oct 2021 16:23:57 +0200 Subject: Address warning about breaking copy elision of temporary object Using `std::move()` on temporary objects prevents copy elision done by compilers. Apple Clang warns about this. Generally `std::move()` should be used sparingly: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines --- source/blender/blenkernel/intern/asset_catalog.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc index 2e01d3cdcea..f66fda1a0bc 100644 --- a/source/blender/blenkernel/intern/asset_catalog.cc +++ b/source/blender/blenkernel/intern/asset_catalog.cc @@ -484,7 +484,7 @@ void AssetCatalogService::undo() BLI_assert_msg(is_undo_possbile(), "Undo stack is empty"); redo_snapshots_.append(std::move(catalog_collection_)); - catalog_collection_ = std::move(undo_snapshots_.pop_last()); + catalog_collection_ = undo_snapshots_.pop_last(); rebuild_tree(); } @@ -493,7 +493,7 @@ void AssetCatalogService::redo() BLI_assert_msg(is_redo_possbile(), "Redo stack is empty"); undo_snapshots_.append(std::move(catalog_collection_)); - catalog_collection_ = std::move(redo_snapshots_.pop_last()); + catalog_collection_ = redo_snapshots_.pop_last(); rebuild_tree(); } @@ -510,12 +510,12 @@ std::unique_ptr AssetCatalogCollection::deep_copy() cons { auto copy = std::make_unique(); - copy->catalogs_ = std::move(copy_catalog_map(this->catalogs_)); - copy->deleted_catalogs_ = std::move(copy_catalog_map(this->deleted_catalogs_)); + copy->catalogs_ = copy_catalog_map(this->catalogs_); + copy->deleted_catalogs_ = copy_catalog_map(this->deleted_catalogs_); if (catalog_definition_file_) { - copy->catalog_definition_file_ = std::move( - catalog_definition_file_->copy_and_remap(copy->catalogs_, copy->deleted_catalogs_)); + copy->catalog_definition_file_ = catalog_definition_file_->copy_and_remap( + copy->catalogs_, copy->deleted_catalogs_); } return copy; -- cgit v1.2.3