Skip to content

Commit 1f0426c

Browse files
sunpoetfacebook-github-bot
authored andcommitted
Fix build with -Wrange-loop-construct (#13273)
Summary: 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<const unsigned int, rocksdb::WriteBatchWithIndex::CFStat>') [-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<const unsigned int, rocksdb::WriteBatchWithIndex::CFStat> &') to prevent copying 208 | for (const auto [cf_id, stat] : wbwi->GetCFStats()) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | & 1 error generated. Pull Request resolved: #13273 Reviewed By: jaykorean Differential Revision: D68109780 Pulled By: cbi42 fbshipit-source-id: a0bc86bb82e8eaf7175c9cae4ae5dbad4f461d8c
1 parent 57c177b commit 1f0426c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

db/db_impl/db_impl_write.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Status DBImpl::IngestWBWI(std::shared_ptr<WriteBatchWithIndex> wbwi,
205205
ColumnFamilySet* cf_set = versions_->GetColumnFamilySet();
206206

207207
// Create WBWIMemTables
208-
for (const auto [cf_id, stat] : wbwi->GetCFStats()) {
208+
for (const auto& [cf_id, stat] : wbwi->GetCFStats()) {
209209
ColumnFamilyData* cfd = cf_set->GetColumnFamily(cf_id);
210210
if (!cfd) {
211211
if (ignore_missing_cf) {

0 commit comments

Comments
 (0)