I'm implementing save/restore functionality for some variables with the help of stl tuples as follows:
double a = 1, b = 2; int c = 3; auto tupleRef = std::make_tuple(std::ref(a), std::ref(b), std::ref(c)); // here I'm saving current state of a, b, c std::tuple<double, double, int> saved = tupleRef; //here goes block of code, where a, b, and c get spoiled ...................... // //now I'm restoring initial state of a, b, c tupleRef = savedTuple; This code works well. But instead of explicit specifying tuple members types in
std::tuple<double, double, int> saved = tupleRef; I'd like to rather remove references from all tupleRef members, like in the following
auto saved = remove_ref_from_tuple_members(tupleRef); I believe that it is possible to write "remove_ref_from_tuple_members" template to that end.
Thanks for answers.