fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #include <set>
  5.  
  6. template <class V, class T>
  7. class Class
  8. {
  9. public:
  10. typedef std::set<const Class<V, T>* > instances_list;
  11.  
  12. explicit Class(const V& Value):m_value(Value)
  13. {
  14. s_instances.insert(this);
  15. }
  16. private:
  17. static instances_list s_instances;
  18. V m_value;
  19. };
  20.  
  21. template <typename V, typename T>
  22. typename Class<V,T>::instances_list Class<V,T>::s_instances;
  23.  
  24. class Something : public Class<int, Something>
  25. {
  26. public:
  27. static const Something SOMETHING_CONSTANT;
  28.  
  29. private:
  30. explicit Something(int value): Class<int, Something>(value)
  31. {}
  32. };
  33.  
  34. const Something Something::SOMETHING_CONSTANT (1);
  35.  
  36.  
  37. int main() {
  38. // your code goes here
  39. return 0;
  40. }
Runtime error #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty