You can use std::tuple and std::tie for this purpose:
#include <iostream> #include <tuple> int main() { /* This is the three-value-array: */ std::tuple<int,double,int> triple { 4, 2.3, 8 }; int i1,i2; double d; /* This is what corresponds to x,y,z = three_value_array: */ std::tie(i1,d,i2) = triple; /* Confirm that it worked: */ std::cout << i1 << ", " << d << ", " << i2 << std::endl; return 0; }
jogojapan
source share