Is there any way to use an anonymous array in a ranged for loop? I'm trying to do something like this
for(auto i: {1,2,3,5,7,11,17}) //do something
Yes there is; it looks like this:
#include <initializer_list> //MUST INCLUDE THIS!
for(auto i: {1,2,3,5,7,11,17}) //do something
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With