fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename TLSManager>
  5. class smr {
  6. public:
  7. TLSManager field;
  8.  
  9. smr(TLSManager field) : field(field) {}
  10.  
  11. static smr<TLSManager>* instance;
  12. };
  13.  
  14. template<typename T>
  15. smr<T>* smr<T>::instance;
  16.  
  17. int main() {
  18. smr<int>::instance = new smr<int>(1);
  19. smr<double>::instance = new smr<double>(2.2);
  20. cout << smr<int>::instance->field << " " << smr<double>::instance->field;
  21. return 0;
  22. }
Success #stdin #stdout 0s 4296KB
stdin
Standard input is empty
stdout
1 2.2