#include <iostream>
#include <tuple>
#include <array>
int main()
{
typedef std::tuple<int, int, int, std::string, std::string> DATA_INFO;
//initialization value
const DATA_INFO info(28, 28, 10, "data", "prob");
// get values:
std::cout << "(" << std::get<0>(info) << ", " << std::get<1>(info)
<< ", " << std::get<2>(info) << ", " << std::get<3>(info)
<< ", " << std::get<4>(info) << ")\n";
std::array<int, 3> arr;
// set values:
std::get<0>(arr) = 1;
std::get<1>(arr) = 2;
std::get<2>(arr) = 3;
// get values:
std::cout << "(" << std::get<0>(arr) << ", " << std::get<1>(arr)
<< ", " << std::get<2>(arr) << ")\n";
}
运行结果:
(28, 28, 10, data, prob)
(1, 2, 3)