Created
January 13, 2020 04:08
-
-
Save LimHyungTae/1ad23e70bc5488e23ed81df52d7ad3aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
vector<float> ints = {0.01, 0.02, 0.03, 0.04}; | |
void main(){ | |
// to avoid copying | |
for (auto &i: ints){ | |
std::cout<< i <<std::endl; | |
} | |
// to prevent to change the value | |
for (auto const i: ints){ | |
std::cout<< i <<std::endl; | |
} | |
// both of them | |
for (auto const &i: ints){ | |
std::cout<< i <<std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment