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
..
2017-06-05 13:23:00 +02:00
2018-01-14 15:37:52 +01:00
2019-02-09 07:24:06 +01:00
2019-04-28 07:48:38 +02:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-04-16 19:07:44 +02:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-03-02 08:06:23 +01:00
2019-02-09 07:24:06 +01:00
2019-04-06 06:54:38 +02:00
2019-03-02 08:06:23 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-02-09 07:24:06 +01:00
2019-03-16 09:17:50 +01:00