diff options
author | Torok Edwin <edwintorok@gmail.com> | 2009-10-07 09:23:56 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2009-10-07 09:23:56 +0000 |
commit | 127445818efd810b138dd5362129ab3c7f8b9963 (patch) | |
tree | a5d0d08d3e7b551b3fdc509703f58c321a5edf05 | |
parent | 4de86fe0d7e19f1156d37292211536258044fe5a (diff) | |
download | external_llvm-127445818efd810b138dd5362129ab3c7f8b9963.tar.gz external_llvm-127445818efd810b138dd5362129ab3c7f8b9963.tar.bz2 external_llvm-127445818efd810b138dd5362129ab3c7f8b9963.zip |
Add a comment explaining how DenseMap::insert works, because it is not
intuitive.
It does NOT update the value if the key is already in the map,
it also returns false if the key is already in the map, regardless
if the value matched.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83458 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/DenseMap.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index daeda28d12..0ed2d5a252 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -145,6 +145,9 @@ public: return ValueT(); } + // Inserts key,value pair into the map if the key isn't already in the map. + // If the key is already in the map, it returns false and doesn't update the + // value. std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) { BucketT *TheBucket; if (LookupBucketFor(KV.first, TheBucket)) |