Displaying 1 result from an estimated 1 matches for "numberdep".
Did you mean:
numberdeps
2017 May 02
2
When to use auto instead of iterator/const_iterator?
...ch [1] I sent before as an example. Could someone give
me advice/guideline here? Also, I have another
question. Sometimes the for-loop uses const_iterator, say
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E =
SU->Succs.end();
I != E; ++I)
if (I->isCtrl())
NumberDeps++;
Can we rewrite above code as,
for (auto &Succ : SU->Succs)
if (Succ.isCtrl())
NumberDeps++;
Or do we need to use `const auto &` instead, like this
for (
const
auto &Succ : SU->Succs)
if (Succ.isCtrl())
NumberDeps++;
Thanks.
[1] https://rev...