This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

catskul

By: a guest on Oct 29th, 2009  |  syntax: C++  |  size: 0.24 KB  |  views: 130  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2.  
  3. template <typename Type>
  4. Type foo( Type arg )
  5. {
  6.         struct Bar
  7.         {
  8.                 Type value;
  9.         };
  10.  
  11.         Bar var;
  12.         var.value = arg;
  13.  
  14.         return var.value;
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20.         printf( "Result is: %i\n", foo<int>(3) );
  21.         return 0;
  22. }
clone this paste RAW Paste Data