From 1482d7f011e3bb417404c6ece6dfad752b1299e7 Mon Sep 17 00:00:00 2001 From: Po-Chuan Hsieh Date: Tue, 7 Jan 2025 10:02:48 +0800 Subject: [PATCH] Fix build with -Wrange-loop-construct db/db_impl/db_impl_write.cc:208:19: error: loop variable '[cf_id, stat]' creates a copy from type 'const value_type' (aka 'const pair') [-Werror,-Wrange-loop-construct] 208 | for (const auto [cf_id, stat] : wbwi->GetCFStats()) { | ^ db/db_impl/db_impl_write.cc:208:8: note: use reference type 'const value_type &' (aka 'const pair &') to prevent copying 208 | for (const auto [cf_id, stat] : wbwi->GetCFStats()) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | & 1 error generated. --- db/db_impl/db_impl_write.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_impl/db_impl_write.cc b/db/db_impl/db_impl_write.cc index 39b03dc7e3a..cda2707ef16 100644 --- a/db/db_impl/db_impl_write.cc +++ b/db/db_impl/db_impl_write.cc @@ -205,7 +205,7 @@ Status DBImpl::IngestWBWI(std::shared_ptr wbwi, ColumnFamilySet* cf_set = versions_->GetColumnFamilySet(); // Create WBWIMemTables - for (const auto [cf_id, stat] : wbwi->GetCFStats()) { + for (const auto& [cf_id, stat] : wbwi->GetCFStats()) { ColumnFamilyData* cfd = cf_set->GetColumnFamily(cf_id); if (!cfd) { if (ignore_missing_cf) {