fork(3) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <list>
  4.  
  5. template<typename T>
  6. class MyVectorCollection
  7. {
  8. using collection = std::vector<T>;
  9. };
  10.  
  11. template<typename C, typename T>
  12. class MyGenericCollection
  13. {
  14. using collection = C;
  15. };
  16.  
  17. template<typename C, typename T>
  18. class MyMoreGenericCollection
  19. {
  20. using collection = C<T>;
  21. };
  22.  
  23. int main() {
  24. // your code goes here
  25. MyVectorCollection<int> a;
  26. MyGenericCollection<std::list<int>, int> b;
  27. MyMoreGenericCollection<std::list, int> c;
  28. return 0;
  29. }
Compilation error #stdin compilation error #stdout 0s 4396KB
stdin
Standard input is empty
compilation info
prog.cpp:20:24: error: ‘C’ is not a template
     using collection = C<T>;
                        ^
prog.cpp: In function ‘int main()’:
prog.cpp:27:43: error: type/value mismatch at argument 1 in template parameter list for ‘template<class C, class T> class MyMoreGenericCollection’
     MyMoreGenericCollection<std::list, int> c;
                                           ^
prog.cpp:27:43: note:   expected a type, got ‘list’
stdout
Standard output is empty