From: Kefu Chai Date: Wed, 25 Aug 2021 14:25:54 +0000 (+0800) Subject: crimson/os: use structured binding in loop X-Git-Tag: v17.1.0~1017^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=935a896bf6998ceb44e3ebc09aaf94ca906847dd;p=ceph.git crimson/os: use structured binding in loop also avoid using `map[key] = val` for setting an item in map, as, if the key does not exist in map, `map[key]` would have to create a value using its default ctor, and then call the `operator=(bufferlist&&)` to set it. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc index 149f87328a156..a7c89d2d2af58 100644 --- a/src/crimson/os/cyanstore/cyan_store.cc +++ b/src/crimson/os/cyanstore/cyan_store.cc @@ -575,8 +575,8 @@ int CyanStore::_omap_set_values( return -ENOENT; ObjectRef o = c->get_or_create_object(oid); - for (auto &&i: aset) { - o->omap[std::move(i.first)] = std::move(i.second); + for (auto&& [key, val]: aset) { + o->omap.insert_or_assign(std::move(key), std::move(val)); } return 0; }