This question already has an answer here:
I'm trying to use a class template as a member of a simple struct. The code below illustrates this:
template <uint8_t id, uint16_t pin>
class class_name
{
// implementation
};
template <uint8_t id, uint16_t pin>
struct struct_name
{
uint8_t data1;
class_name<id, pin> data2;
};
Then I need to create an array of 'struct_name' in another class that is another template.
template <uint8_t N>
class other_class
{
private:
static struct_name _array[N];
public:
// other members
};
When I try to compile this code, the compiler gives me the following errors:
- '_array' was not declared in this scope
- invalid use of template-name 'struct_name' without an argument list
What am I doing wrong? Are there missing template parameters somewhere?
Aucun commentaire:
Enregistrer un commentaire