Yarp: auto instead of iterator in YARP

Created on 15 Jun 2018  路  2Comments  路  Source: robotology/yarp

We should replace all the iterator usages with auto.

auto has the twofold advantage, is shorter than std::map<std::string, MyClass>::iterator, and the it prevent from implicit conversion because using the wrong type of the iterator.
auto will guarantee that no implicit conversion is involved.

It is actually a minor improvement, and it has the drawback that the code became less readable.

YARP v3.2.0 FeaEnh Req Fixed Modernization

Most helpful comment

As already discussed in another issue, I think that the use of auto in the iterator is ok (the trade-off pays quite well).

Just be careful of the possibility of
const auto& it or auto it or auto& it or there is also I think the double ampersand auto &&it

All 2 comments

As already discussed in another issue, I think that the use of auto in the iterator is ok (the trade-off pays quite well).

Just be careful of the possibility of
const auto& it or auto it or auto& it or there is also I think the double ampersand auto &&it

A lot of these were ported using clang-tidy, see 73df6c3f7751f886c030d652b310f3b6986aa0cd
I cannot exclude that there might be more hidden, but we will fix them when we find them

Was this page helpful?
0 / 5 - 0 ratings