//
// main.cpp
// Tuple
//
// Created by Himanshu on 11/04/22.
//
#include <iostream>
#include <tuple>
#include <vector>
#include <string>
using namespace std;
int main () {
//Initializations
//using make_tuple
tuple<int, string, int> tupleFirst = make_tuple(1, "Anon", 98);
//using value init
tuple<int, string, int> tupleLast (7, "Glee", 67);
//using copy constructor
tuple<int, string, int> tupleTemp(tupleLast);
cout<<"tupleTemp values:"<<endl;
cout<<get<0>(tupleTemp)<<", "<<get<1>(tupleTemp)<<", "<<get<2>(tupleTemp)<<endl<<endl;
vector<int> rankMarks = {95, 90, 87, 83, 75};
vector<string> rankNames = {"Bruw", "Cync", "Droke", "Elph", "Frel"};
vector<tuple<int, string, int>> nameList;
nameList.push_back(tupleFirst);
int n = (int) rankMarks.size();
for (int i=0; i<n; i++) {
nameList.push_back(make_tuple(i+2, rankNames[i], rankMarks[i]));
}
nameList.push_back(tupleLast);
cout<<"Size of (vector) nameList: "<<nameList.size()<<endl<<endl;
for (tuple<int, string, int> t: nameList) {
cout<<get<0>(t)<<" "<<get<1>(t)<<" "<<get<2>(t)<<endl;
}
return 0;
}
Ly8KLy8gIG1haW4uY3BwCi8vICBUdXBsZQovLwovLyAgQ3JlYXRlZCBieSBIaW1hbnNodSBvbiAxMS8wNC8yMi4KLy8KCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHR1cGxlPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluICgpIHsKICAgICAKICAgIC8vSW5pdGlhbGl6YXRpb25zCiAgICAvL3VzaW5nIG1ha2VfdHVwbGUKICAgIHR1cGxlPGludCwgc3RyaW5nLCBpbnQ+IHR1cGxlRmlyc3QgPSBtYWtlX3R1cGxlKDEsICJBbm9uIiwgOTgpOwogICAgCiAgICAvL3VzaW5nIHZhbHVlIGluaXQKICAgIHR1cGxlPGludCwgc3RyaW5nLCBpbnQ+IHR1cGxlTGFzdC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