You can get the value of the n
th element of an std::tuple
using std::get<n>(tuple)
. But I need to pass one element of that tuple as reference to a function.
How do I get the reference to an element of a std::tuple
?
get
returns a reference, rvalue reference or const reference depending on the type of its argument.
std::get
returns a reference to the element at the specified position in the tuple.
来源:https://stackoverflow.com/questions/15835762/how-to-get-reference-to-an-element-of-a-stdtuple