Created
August 23, 2020 17:52
-
-
Save chrisjurich/295d61433f35982fadb181f1790d270c to your computer and use it in GitHub Desktop.
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<tuple> | |
#include<vector> | |
#include<map> | |
#include<iostream> | |
/////////////////////////////////////////////////////////////////// | |
/////////////////////////////////////////////////////////////////// | |
/////////////////////////////////////////////////////////////////// | |
// NOTE: you have to pass the flag "-std=c++17" to the compiler. | |
/////////////////////////////////////////////////////////////////// | |
/////////////////////////////////////////////////////////////////// | |
/////////////////////////////////////////////////////////////////// | |
using TUPLE = std::tuple<int,int,int,int,int>; | |
using TUPLES = std::vector<TUPLE>; | |
int main() { | |
auto M = std::map<int,int>{{1, 2}, | |
{3,4}, | |
{5,6}}; | |
for(auto& [F,S] : M ) { | |
std::cout<<F<<"\t"<<S<<std::endl; | |
} | |
auto T = TUPLES{ | |
{1,2,3,4,5}, | |
{10,20,30,40,50}, | |
}; | |
for(auto& [first,second,third,fourth,fifth] : T) { | |
std::cout<<first<<"\t"<<second<<"\t"<<third<<"\t"<<fourth<<"\t"<<fifth<<std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment