2 ms·
I think he was concerned about the cost of allocating separate strings that go into the vector.
by milemi 8y ago
I think he was concerned about the cost of allocating separate strings that go into the vector.
- romka2 8y agoYep, every string is potentially an allocation (unless it's short and std::string implements Small String Optimization) plus O(log N) allocations by the vector itself. C++11 didn't make returning the vector in this function faster because it's written in a way to take advantage of RVO. It did make growing the vector faster though -- individual strings now get moved instead of copied.