fork(3) download
  1. #include <vector>
  2. using std::vector;
  3.  
  4. struct TypeProvider
  5. {
  6. template<typename T> struct Container { typedef vector<T> type; };
  7. };
  8.  
  9. template<template<class T> class Container, class Obj>
  10. struct Type
  11. {
  12. typedef typename Container<Obj>::type type;
  13. };
  14.  
  15. template<typename Provider>
  16. class TypeConsumer
  17. {
  18. typedef typename Type<Provider::Container, int>::type intContainer;
  19. typedef typename Type<Provider::Container, double>::type doubleContainer;
  20. };
  21.  
  22. int main(){}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:18:49: error: to refer to a type member of a template parameter, use ‘typename Provider:: Container’ [-fpermissive]
   typedef typename Type<Provider::Container, int>::type intContainer;
                                                 ^
prog.cpp:18:49: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<class T> class Container, class Obj> struct Type’
prog.cpp:18:49: error:   expected a class template, got ‘typename Provider::Container’
prog.cpp:19:52: error: to refer to a type member of a template parameter, use ‘typename Provider:: Container’ [-fpermissive]
   typedef typename Type<Provider::Container, double>::type doubleContainer;
                                                    ^
prog.cpp:19:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<class T> class Container, class Obj> struct Type’
prog.cpp:19:52: error:   expected a class template, got ‘typename Provider::Container’
stdout
Standard output is empty