Get the latest tech news
Don't blindly prefer `emplace_back` to `push_back`
In one of my recent training courses, a student informed me that both clang-tidy and PVS-Studio were complaining about some code of the form
In one of my recent training courses, a student informed me that both clang-tidy and PVS-Studio were complaining about some code of the form Both tools flagged this line as “bad style.” clang-tidy even offered a (SARCASM ALERT) helpful fixit: emplace_back, on the other hand, is a dumb perfect-forwarding template: it doesn’t know that the relevant constructor overload will end up being string(const char *) in each case.
Or read this on Hacker News