Conversation
|
The idea here was that we might be able to address some of the findings by using conditional code. |
|
| const std::string::size_type eq = config.find('='); | ||
| const std::string config2 = (eq != std::string::npos) ? config.substr(0, eq) : config + "=" + config; | ||
| const std::set<std::string>::iterator it2 = ret.find(config2); | ||
| const auto it2 = utils::as_const(ret).find(config2); |
There was a problem hiding this comment.
what is the point of making it const? I find it a little weird to create the iterator for the const object and then comparing it to the end iterator of the non-const object. this is invalid if as_const would return a constant copy so it depends on a implementation detail..
There was a problem hiding this comment.
what is the point of making it const?
So we get a const_iterator. Before it was mutable which was unnecessary. I added the constness. Unfortunately there is no cfind() and the result depends on the object.
I find it a little weird to create the iterator for the const object and then comparing it to the end iterator of the non-const object.
It is the same object. iterator and const_iterator can be compared which each other so end() and cend() are interchangeable. I have some local changes cleaning this up and also thought about filing tickets to detect such inconsistencies-
this is invalid if as_const would return a constant copy so it depends on a implementation detail..
It is not a copy - it is a cast.



No description provided.