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(std::unique_ptr<T>(new T())))...);
  23. [](...){ }((m_types.push_back(new T()))...);
  24. }
  25.  
  26. private:
  27. //std::list<std::unique_ptr<IBaseType>> m_types;
  28. std::list<IBaseType*> m_types;
  29. };
  30.  
  31. int main()
  32. {
  33. CreateTypes<Type1, Type2> createTypes;
  34. return 0;
  35. }
Compilation error #stdin compilation error #stdout 0s 3024KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘CreateTypes<T>::CreateTypes() [with T = {Type1, Type2}]’:
prog.cpp:33:28:   required from here
prog.cpp:23:2: error: invalid use of void expression
stdout
Standard output is empty