December 2001
Intermediate to advanced
304 pages
6h 25m
English
Difficulty: 6
How do you specialize and overload templates? When you do, how do you determine which template gets called? Try your hand at analyzing these 12 examples.
What is template specialization? Give an example.
What is partial specialization? Give an example.
Consider the following declarations:
template<typename T1, typename T2> void g( T1, T2 ); // 1 template<typename T> void g( T ); // 2 template<typename T> void g( T, T ); // 3 template<typename T> void g( T* ); // 4 template<typename T> void g( T*, T ); // 5 template<typename T> void g( T, T* ); // 6 template<typename T> void g( int, T* ); // 7 template<> void g<int>( int ); // 8 void g( int, double ); // 9 void g( int ); // 10
Which ...
Read now
Unlock full access