fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int i = 1;
  5.  
  6. template<class T>
  7. void regist()
  8. {
  9. ++i;
  10. }
  11.  
  12. template<class T>
  13. class A
  14. {
  15. static bool d;
  16. };
  17.  
  18. template<class T> bool A<T>::d = [](){regist<A<T>>(); return true;}();
  19.  
  20. int main()
  21. {
  22. A<int> a;
  23. cout << i << endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1