home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C19 / TemplateFunctionAddress.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  572 b   |  27 lines

  1. //: C19:TemplateFunctionAddress.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Taking the address of a function generated
  7. // from a template.
  8.  
  9. template <typename T> void f(T*) {}
  10.  
  11. void h(void (*pf)(int*)) {}
  12.  
  13. template <class T> 
  14.   void g(void (*pf)(T*)) {}
  15.  
  16. int main() {
  17.   // Full type exposition:
  18.   h(&f<int>);
  19.   // Type induction:
  20.   h(&f);
  21.   // Full type exposition:
  22.   g<int>(&f<int>);
  23.   // Type inductions:
  24.   g(&f<int>);
  25.   g<int>(&f);
  26. } ///:~
  27.