Which of the following ways of declaring a function template that takes a structure T as a parameter are syntactically correct?
//1:
template < typename T, int T::member >
void some_function() {}

//2:
template < class T, int *T::member >
void some_function() {}

//3:
template < typename T, int &T::member >
void some_function() {}

//4:
template < class T, int T::*member >
void some_function() {}

//5:
template < typename T, int T::&member >
void some_function()
{}
Explanation
Get an explanation when it's available:

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes