#include<bits/stdc++.h>
using namespace std;
int main()
{
tuple<char, int, double>t1, t2;
t1 = make_tuple('A', 100, 200.75);
t2 = make_tuple('B', 300, 400.75);
cout << "First Tuple :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
cout << "Second Tuple :: " << get<0>(t2) << " " << get<1>(t2) << " " << get<2>(t2) << "\n";
get<1>(t1) = 150;
get<2>(t1) = 250.75;
cout << "\nFirst Tuple After Value Change :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
t1.swap(t2);
cout << "\nAfter Swap :: \n";
cout << "First Tuple :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
cout << "Second Tuple :: " << get<0>(t2) << " " << get<1>(t2) << " " << get<2>(t2) << "\n";
cout << "\nFirst Tuple Size :: " << tuple_size<decltype(t1)>::value << "\n";
auto t3 = tuple_cat(t1, t2);
cout << "\nThird Tuple is :: ";
cout << get<0>(t3) << " " << get<1>(t3) << " " << get<2>(t3) << " " << get<3>(t3) << " " << get<4>(t3) << " " << get<5>(t3) << "\n";
return 0;
}
using namespace std;
int main()
{
tuple<char, int, double>t1, t2;
t1 = make_tuple('A', 100, 200.75);
t2 = make_tuple('B', 300, 400.75);
cout << "First Tuple :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
cout << "Second Tuple :: " << get<0>(t2) << " " << get<1>(t2) << " " << get<2>(t2) << "\n";
get<1>(t1) = 150;
get<2>(t1) = 250.75;
cout << "\nFirst Tuple After Value Change :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
t1.swap(t2);
cout << "\nAfter Swap :: \n";
cout << "First Tuple :: " << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << "\n";
cout << "Second Tuple :: " << get<0>(t2) << " " << get<1>(t2) << " " << get<2>(t2) << "\n";
cout << "\nFirst Tuple Size :: " << tuple_size<decltype(t1)>::value << "\n";
auto t3 = tuple_cat(t1, t2);
cout << "\nThird Tuple is :: ";
cout << get<0>(t3) << " " << get<1>(t3) << " " << get<2>(t3) << " " << get<3>(t3) << " " << get<4>(t3) << " " << get<5>(t3) << "\n";
return 0;
}
Comments
Post a Comment