0

I have some code:

template<typename Container = std::vector> // there is error
class SomeClass {
    struct SomeDataStructure {
        int a;
        float b;
    };

    Container<SomeDataStructure> container; // and there
};

I want to pass template class type in template arguments of other template class.
In this example, I want to pass std::vector to SomeClass and define Container(std::vector) of private structure SomeDataStructure.
But I'm getting errors(MSVC compiler) C2059 and C2238.
How can I solve it?
Thanks in advance!

User98
  • 31
  • 6
  • when facing a compiler error, please include the complete error message in the question. Error codes are specific to compilers, while the problem with your code is the same with any compiler. Anyhow, you need a template tempalte paramter as explained in the duplicate – 463035818_is_not_an_ai Oct 24 '20 at 13:01

1 Answers1

1

You need template template parameters:

template<template<class, class...> class Container = std::vector>
Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108