Commit Graph

14 Commits

Author SHA1 Message Date
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
Sebastian 53357f2f31
boost.cfg: Add configuration for Boosts smart pointers (#1811) 2019-04-26 12:41:44 +02:00
versat 6f7612de03 boost.cfg: Add argument directions; some fixes; rearrange and document.
- Remove redundant function configurations for the same function since
it is not (yet) possible to configure overloaded functions. Instead mark
the optional arguments with `default="0"` so the configuration works
with a different number of arguments.
- Add documentation to boost.cfg (links and function declarations).
- Rearranged configurations so functions, defines, ... are together now.
- Add `direction` for function arguments where applicable.
- Add some tests to boost.cpp.
2019-03-15 11:13:08 +01:00
Sebastian 08d41ab8af
Load std.cfg before all other libraries (#1740)
- CLI: Save the libraries that should be loaded to a list and load them
after the std.cfg has been loaded.
- GUI: Load std.cfg (and windows.cfg / posix.cfg when applicable) before
setting other options and loading the other libraries.
In the project-file-dialog the std.cfg is searched first. If some
other library fails to load is is retried with first loading std.cfg.
- boost.cfg: Enable containers that depend on std containers.
2019-03-15 06:59:37 +01:00
orbitcowboy b7c40d972b boost.cfg: Fixed typo in macro. 2019-03-05 19:00:13 +01:00
orbitcowboy 2ddba8f352 boost.cfg: Added support for BOOST_LOG_ATTRIBUTE_KEYWORD-macro. 2019-03-05 18:53:34 +01:00
orbitcowboy 571e6bcecc running astyle. 2019-02-22 16:15:08 +01:00
Steven Cook 71018d6d17 boost.cfg additions (#1680) 2019-02-22 15:21:06 +01:00
orbitcowboy 8820580cf6 boost.cfg: Improved support for more test macros. 2019-02-17 22:36:36 +01:00
orbitcowboy b886590cc9 boost.cfg: Improved support for more test macros. 2019-02-17 21:14:03 +01:00
orbitcowboy 4e42f83bc8 boost.cfg: Fixed some 'unknownMacro'-warnings from daca@home. 2019-02-17 20:52:54 +01:00
Sebastian 0aa4910244
Boost configuration: Add macros and initial test file (#1575) 2019-01-08 20:30:21 +01:00
orbitcowboy 02e1637553 wxwidgets.cfg: Improved support for some wxBitmap functions. 2018-12-13 17:04:02 +01:00
Daniel Marjamäki b91ef62932 Add boost.cfg 2018-12-13 09:06:35 +01:00