I have the following function:
template<typename T>
void f(const T& val) {
using value_type = T;
using sub_type = typename value_type::sub_type;
//etc...
}
However, I am running into the problem that the compiler is telling me that T is not fact whatever type it is, but instead a reference to it. How is that possible, in what circumstances are template parameter for const-references themselves references?
Note, I can work around the above issue with:
using value_type = std::remove_reference_t<T>;
but I'd like to understand what circumstances T, itself, would be a reference.