This is the struct that I have and I’m trying to write the default constructor for that.
struct Cnode
{
typedef std::map<char, int> nextmap;
typedef std::map<char, int> prevmap;
Cnode() : nextmap(), prevmap() {} //error
Cnode(const nextmap2, const prevmap2) : nextmap(nextmap2), prevmap(prevmap2) {}
};
Please help me understand what this error means:
Type 'nextmap'(aka 'map<char,int>') is not a direct or virtualbase of 'Cnode'
Type 'prevmap'(aka 'map<char,int>') is not a direct or virtualbase of 'Cnode'
Because
nextmapandprevmaparen’t variables, but types. As clearly indicated by thetypedef(it defines a type).Did you mean:
or perhaps this might clear your confusion: