~smspillaz/folly/folly-git-master

Viewing all changes in revision 7478.

  • Committer: Facebook Github Bot
  • Author(s): Joe Romano
  • Date: 2019-08-23 00:17:17 UTC
  • Revision ID: git-v1:33fb91d9ae03f85549a54f9738221841955b6f73
Add docs to insert_or_assign re: inconsistency with std::map interface

Summary:
`ConcurrentHashMap::insert_or_assign` does not follow the interface for `std::map::insert_or_assign`.  Making this clear for future users to avoid confusion.

Code:
```
int main(int argc, char** argv) {
  folly::ConcurrentHashMap<int, std::string> map;
  std::cout << "Insertion took place?: " << map.insert_or_assign(1, "hey").second << std::endl;
  std::cout << "Insertion took place?: "
<< map.insert_or_assign(0, "wow").second << std::endl;
  std::cout << "Insertion took place?: "
<< map.insert_or_assign(1, "wow").second << std::endl;
}
```

Output:
```
Insertion took place?: 1
Insertion took place?: 1
Insertion took place?: 1
```

Also see: https://github.com/facebook/folly/blob/master/folly/concurrency/test/ConcurrentHashMapTest.cpp#L86-L87

Reviewed By: magedm

Differential Revision: D16967939

fbshipit-source-id: ce0d32813371b31a94e14e404665d4fb2e7ffdfe

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: