const iterators should use cbegin/cend
While writing !1031 (merged), I naïvely copied some code, resulting in this logic (now fixed in the MR):
for (std::vector<std::string>::const_iterator i = includesList.begin();
i != includesList.end(); ++i) {
The container (includesList
) here is mutable. As a result, this code contains unnecessary conversions from iterator
to const_iterator
. The code should use cbegin
/cend
instead of begin
/end
.
This pattern occurs frequently throughout the code base and would presumably be a good candidate for automated code tidying.