I'm curious as to the lookup time that a call to std::get<>
on a std::tuple<>
takes. Some brief googling (including the reference pages which usually have this information) turned up no results.
My initial intuition (and fear) is that the recursive structure of tuple (if it is implemented as a variadic template) would lead to get requiring an order of N lookups (A call to get<3>(t)
looking like t.rest().rest().first()
. I'm hoping I'm way off here...
Then again, I would hope the compiler would be able to optimize this to directly return the correct offset without the overhead of N of calls.
Basically what I want: is there a specced guarantee on runtime? does this restrict how std::tuple
is implemented?