[llvm] Add StringMap::lookup() overload to take a default value and return a reference to the value to avoid a copy (PR #115469)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 05:10:37 PST 2024
================
@@ -257,6 +257,15 @@ class LLVM_ALLOCATORHOLDER_EMPTYBASE StringMap
return ValueTy();
}
+ /// lookup - Return the entry for the specified key, or a default
+ /// provided value if no such entry exists.
+ const ValueTy &lookup(StringRef Key, const ValueTy& Value) const {
----------------
kuhar wrote:
Do we have examples of APIs with the same behavior in the standard library or ADT?
https://github.com/llvm/llvm-project/pull/115469
More information about the llvm-commits
mailing list