Reputation: 39
I'm trying to create a tree class to a test, but I'm getting: "error: type/value mismatch at argument 1 in template parameter list for 'template class std::vector".
template <typename T>
struct a {
T data;
void ReceiveData(T T_data) {
data = T_data;
}
};
struct b {
std::vector<a> b_data;//Error here
};
Upvotes: 1
Views: 76
Reputation: 7374
You need to specify the template type of a
:
template<typename T> struct a
{
T data;
void ReceiveData(T T_data)
{
data = T_data;
}
};
template<typename T> struct b
{
std::vector<a<T>> b_data; //compiles now
// ^^^^
};
Note that a
alone is not a type, it is a template.
Live on Godbolt
Upvotes: 4