std::string copy constructors: I tried to count these using code search, but its facility for restricting references to those matching a path doesn't have a way to anchor at the start of the path. So, the answer is roughly 759 including some other things that happen to have "net/" in the path and excluding tests.
Counting push_backs that don't follow a reserve() is rather more work than I have time for, but I can count calls:
- std::vector::push_back: roughly 260 for const&, 1592 for &&, total 1852
- std::vector::reserve: 100
As above, this randomly includes other stuff that happens to have "net/" in the path.
Of course, it's not always wrong to use push_back() without reserve(). If you don't know what the final size will be, but it's usually 0 or 1 anyway, then there's no point in calling reserve().
I'm a big fan of base::ToVector() because it does the right thing automatically. You can rewrite
std::vector<std::string> cert_bytes;
for (const auto& cert : certs) {
cert_bytes.push_back(cert->der_cert().AsString());
}
as
std::vector<std::string> cert_bytes = base::ToVector(
certs,
[](const auto& cert) { return cert->der_cert().AsString(); });
and it reserves the right size for you.