fork download
  1. template <typename... List>
  2. struct TypeList
  3. {
  4. enum
  5. {
  6. Length = sizeof...(List)
  7. };
  8. };
  9.  
  10. template <typename ToErase, typename... List>
  11. struct Erase;
  12.  
  13. template <typename ToErase>
  14. struct Erase<ToErase, TypeList<>>
  15. {
  16. typedef TypeList<> Result;
  17. };
  18.  
  19. template <typename ToErase, typename... Head, typename... Tail>
  20. struct Erase<ToErase, TypeList<Head..., ToErase, Tail...>>
  21. {
  22. typedef TypeList<Head..., Tail...> Result;
  23. };
  24.  
  25. int main()
  26. {
  27. static_assert(Erase<double, TypeList<int, double, char>>::Result::Length == 2, "Did not erase double from TypeList<int, double, char>");
  28.  
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:27:63: error: ‘Erase<double, TypeList<int, double, char> >::Result’ has not been declared
stdout
Standard output is empty