Consider the following code:
template<typename T> void foo(T&& some_struct)
{
bar(std::forward</* what to put here? */>(some_struct.member));
}
In the case of forwarding the whole struct I would do std::forward<T>(some_struct)
. But how do I get the correct type when forwarding a member?
One idea I had was using decltype(some_struct.member)
, but that seems to always yield the base type of that member (as defined in the struct definition).