[upstream_utils] StringMap: fix structured bindings with move-only types (#7127)

This commit is contained in:
Ryan Blue
2024-09-25 01:11:41 -04:00
committed by GitHub
parent 69af7785f6
commit b8ff3fcee2
40 changed files with 112 additions and 38 deletions

View File

@@ -159,7 +159,17 @@ decltype(auto) get(const StringMapEntry<ValueTy> &E) {
if constexpr (Index == 0)
return E.first();
else
return E.second;
return (E.second);
}
// Allow structured bindings on StringMapEntry.
template <std::size_t Index, typename ValueTy>
decltype(auto) get(StringMapEntry<ValueTy> &E) {
static_assert(Index < 2);
if constexpr (Index == 0)
return E.first();
else
return (E.second);
}
} // end namespace wpi