fork download
  1. #include <iostream>
  2.  
  3. template<class T>
  4. class MyClass{
  5. public:
  6. inline MyClass(const T &t);
  7. template<class C>
  8. void MyUberFunction(const C &c)
  9. {
  10. std::cout<<"My t: "<<m_t<<std::endl;
  11. std::cout<<"Do uber things with: "<<&c<<std::endl;
  12. }
  13. private:
  14. T m_t;
  15. };
  16.  
  17. template<class T>
  18. MyClass<T>::MyClass(const T &t):
  19. m_t(t)
  20. {
  21. }
  22.  
  23. int main(int argc, char *argv[])
  24. {
  25. MyClass<int> myInstance(1337);
  26. myInstance.MyUberFunction("Another type");
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
My t: 1337
Do uber things with: 0x8048a7d