Paul Fultz II 091f4bcf8d Add check for unnecessary search before insertion
This will warn for cases where searching in an associative container happens before insertion, like this:

```cpp
void f1(std::set<unsigned>& s, unsigned x) {
    if (s.find(x) == s.end()) {
        s.insert(x);
    }
}

void f2(std::map<unsigned, unsigned>& m, unsigned x) {
    if (m.find(x) == m.end()) {
        m.emplace(x, 1);
    } else {
        m[x] = 1;
    }
}
```

In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.

I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
..
2019-04-28 07:40:00 +02:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-04-18 20:21:00 +02:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-05-01 16:34:28 +02:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-04-06 06:54:38 +02:00
2019-04-06 06:54:38 +02:00
2019-05-01 16:34:28 +02:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-03-16 09:17:50 +01:00
2019-04-14 15:00:03 +02:00
2019-03-23 08:36:10 +01:00
2019-04-14 15:00:03 +02:00
2019-05-01 16:34:28 +02:00
2019-04-28 07:58:47 +02:00