fork(8) download
  1. template<class T>
  2. class CMemoryPool
  3. {
  4. public:
  5. CMemoryPool(int param1)
  6. : stuff(param1)
  7. {}
  8.  
  9. void setValue(int value) { stuff = value; }
  10.  
  11. private:
  12. int stuff;
  13. };
  14.  
  15. template<class T>
  16. class CList
  17. {
  18. public:
  19. struct Entry
  20. {
  21. T data;
  22. };
  23.  
  24. static CMemoryPool<Entry> s_pool;
  25.  
  26. void DoStuffWithPool()
  27. {
  28. s_pool.setValue(2);
  29. }
  30. };
  31.  
  32. template<class T>
  33. CMemoryPool<typename CList<T>::Entry> CList<T>::s_pool(1);
  34.  
  35. int main()
  36. {
  37. CList<int> list;
  38. list.DoStuffWithPool();
  39. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty