fork download
  1. #include <list>
  2. #include <memory>
  3.  
  4. struct IBaseType
  5. {
  6. };
  7.  
  8. class Type1 : public IBaseType
  9. {
  10. };
  11.  
  12. class Type2 : public IBaseType
  13. {
  14. };
  15.  
  16. template <typename... T>
  17. class CreateTypes
  18. {
  19. public:
  20. CreateTypes()
  21. {
  22. [](...){ }((m_types.push_back(new T()))...);
  23. }
  24.  
  25. private:
  26. std::list<IBaseType*> m_types;
  27. };
  28.  
  29. int main()
  30. {
  31. CreateTypes<Type1, Type2> createTypes;
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘CreateTypes<T>::CreateTypes() [with T = {Type1, Type2}]’:
prog.cpp:31:31:   required from here
prog.cpp:22:9: error: invalid use of void expression
stdout
Standard output is empty