+ 2

Which loop is more faster for vector

Hello We have three option to iterate vector as per below code : Range based loop is always good as it access same elements due to auto and reference. If index is required , then we choose index based where as iterator based is best suited in which case ? Does index based faster than iterator based ? https://code.sololearn.com/cge5J0VCi77s/?ref=app

7th Mar 2021, 12:17 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Réponses
+ 2
It depends on the compiler and machine that you use. They all have a significant application at different times.
7th Mar 2021, 3:29 PM
Sharique
0
Sharique does it really depend on compiler nd machine ??
7th Mar 2021, 4:55 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
It depends on your Compiler...
8th Mar 2021, 5:57 PM
Deeproshan Kumar