diff options
author | Julian Eisel <julian@blender.org> | 2021-10-12 17:23:57 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-12 17:28:48 +0300 |
commit | 1db42c9b7967507d5d3ac688fb1a4a36bfac5f95 (patch) | |
tree | 6838368ba405562ceddb1a3fdbc59319263a5873 /source/blender/blenkernel/intern/asset_catalog.cc | |
parent | aaf3a63dca54d154711753455d9f1ef3957e99e7 (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog.cc')
-rw-r--r-- | source/blender/blenkernel/intern/asset_catalog.cc | 12 |
1 files changed, 6 insertions, 6 deletions
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> AssetCatalogCollection::deep_copy() cons { auto copy = std::make_unique<AssetCatalogCollection>(); - 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; |