ベクトル反復子を使用して、ベクトル内のすべての要素を出力しようとしています。同様の質問を調べましたが、投稿された解決策がうまくいかないようです。コードは次のとおりです。
void printPerms()
{
for(vector<process>::iterator it = allProcesses.begin(); it != allProcesses.end(); it++)
{
for(int i = 0; i < numResourceTypes; i++)
{
cout << (static_cast<process*>(*it).need) << (static_cast<process>(*it)).allocated <<endl;
}
}
}
そして、私が得ているエラーは、修正方法がわかりません:
error C2440: 'static_cast' : cannot convert from 'process' to 'process *' No user
defined-conversion operator available that can perform this conversion, or the operator
cannot be called
error C2228: left of '.need' must have class/struct/union