What is the difference, if any, between
template <typename T, int N>
void input (T (&Array) [N])
{
for (T& val: Array) cin >> val;
}
and
template <typename T>
void input (T (&store))
{
for (auto& val: Array) cin >> val;
}
N.B. The former won't compile with T (&Array) []
since that is a "reference to array of unknown bound". The latter won't compile if we wrote T& val: Array
instead.
Aucun commentaire:
Enregistrer un commentaire