Created
December 27, 2017 04:21
-
-
Save mtao/8edccac1c433b4b44240de23852eb484 to your computer and use it in GitHub Desktop.
turns out structured bindings work in ranged for loops!
This file contains hidden or 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 <map> | |
#include <iostream> | |
int main() { | |
std::map<int,int> pairs; | |
pairs[0] = 1; | |
pairs[1] = 5; | |
pairs[2] = 4; | |
pairs[3] = 3; | |
pairs[4] = 2; | |
for(auto&& [k,v]: pairs) { | |
std::cout << k << " => " << v << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment