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::
A simple type alias can be used to apply std::remove_reference
to all types in a tuple.
template
using tuple_with_removed_refs = std::tuple::type...>;
Armed with this you can now write the function template:
template
tuple_with_removed_refs remove_ref_from_tuple_members(std::tuple const& t) {
return tuple_with_removed_refs { t };
}