#include <iostream>
#include <string>
#include <tuple>
int main()
{
std::tuple<char, int, double, const char *, std::string> s;
std::tuple<char, int, double, const char *, std::string> t;
s = std::make_tuple('A', 1, 2.5, "three", "four");
t = std::make_tuple('A', 1, 2.5, "three", "four");
if (s == t) std::cout << "Tuples Match, ";
double myDouble = std::get<2>(s);
std::cout << myDouble << std::endl;
return 0;
}
// Output: Tuples Match, 2.5
Reference: https://isocpp.org/wiki/faq/cpp11-library#tuplehttp://en.cppreference.com/w/cpp/utility/tuple
No comments:
Post a Comment