その文字を処理するために、文字を規則の 2 次元配列にマッピングするマップがあります。コードは次のとおりです。
struct CFG //this struct is data structure to contain a context free grammar
{
vector<char> *V;
vector<char> *T;
map<char,vector<vector<rhs>*>*> *prod;
// char start;
};
int main()
{
map<char,vector<vector<rhs>*>*> *prod; //rhs is the type of each cell of the 2-d array
CFG cfg1;
cfg1.V= new vector<char>;
//We imput elements into the V array here......//
cfg1.prod= new map<char,vector<vector<rhs>*>*>;
for(int i=0;i<cfg1.V->size();i++)
{
vector<vector<rhs>*>* all_prod_of_one_nonter= new vector<vector<rhs>*>;
*(cfg1.prod)[*(cfg1.V)[i]]=all_prod_of_one_nonter; //error occurs here//////
}
}
行で、「エラーが発生しました」とマークすると、次のエラーが発生します。
q1.cpp: In function ‘int main()’:
q1.cpp:93:29: error: no match for ‘operator*’ in ‘**(cfg1.CFG::V + ((unsigned int)(((unsigned int)i) * 12u)))’
* を使用してポインター cfg1.V を逆参照し、添字表記を使用して配列セルにアクセスできるようにします。エラーを取り除く方法は?