Use C++17 structured binding in more places.

Bug: dawn:824
Change-Id: Ie39d4f622bfb3dcc3a74b03d594efcea7139a9dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75069
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2022-01-06 09:17:57 +00:00
committed by Dawn LUCI CQ
parent 1c49d1b43b
commit 5984d8d1a8
28 changed files with 101 additions and 124 deletions

View File

@@ -59,16 +59,16 @@ namespace dawn_wire { namespace client {
// Move mRequests to a local variable so that further reentrant modifications of
// mRequests don't invalidate the iterators.
auto allRequests = std::move(mRequests);
for (auto& it : allRequests) {
closeFunc(&it.second);
for (auto& [_, request] : allRequests) {
closeFunc(&request);
}
}
}
template <typename F>
void ForAll(F&& f) {
for (auto& it : mRequests) {
f(&it.second);
for (auto& [_, request] : mRequests) {
f(&request);
}
}

View File

@@ -191,8 +191,8 @@ namespace dawn_wire { namespace server {
}
bool TrackDeviceChild(DeviceInfo* info, ObjectType type, ObjectId id) {
auto it = info->childObjectTypesAndIds.insert(PackObjectTypeAndId(type, id));
if (!it.second) {
auto [_, inserted] = info->childObjectTypesAndIds.insert(PackObjectTypeAndId(type, id));
if (!inserted) {
// An object of this type and id already exists.
return false;
}