template <typename T>
void DisplayVector(const vector<T>& inVec)
{
for (const auto& element : inVec)
cout << element << ' ';
cout << endl;
}
and
template <typename T>
void DisplayVector(const vector<T>& inVec)
{
for (auto element : inVec)
cout << element << ' ';
cout << endl;
}
How much information (like const
and &
) can the compiler infer from the type of inVec
? What is the type difference of the two element
s in the above code?