ベクトルに保存されているベクトルがいくつかあります。それらに対して特定の論理操作を実行する必要があります。操作が正常に完了した場合、arrayOfUsers に保存されているそのベクトルを保存する必要があります。問題は、arrayOfusers 内に格納されている特定のベクトルにアクセスできないことです
例: arrayOfUsers には 3 つのベクトルが格納されており、ファイルにベクトル番号 2 を書き込まなければならない論理演算を渡します。arrayOfUsers 内のインデックスでベクトルに直接アクセスできません
vector<string> usersA ("smith","peter");
vector<string> usersB ("bill","jack");
vector<string> usersC ("emma","ashley");
vector<vector<string>> arrayOfUsers;
arrayOfUsers.push_back(usersA);
arrayOfUsers.push_back(usersB);
arrayOfUsers.push_back(usersC);
私はループのために実行します
for ( auto x=arrayOfUsers.begin(); x!=arrayOfUsers.end(); ++x)
{
for (auto y=x->begin(); y!=x->end(); ++y)
{
//logic operations
}
if(logicOperationPassed== true)
{
// i cannot access the vector here, which is being pointed by y
//write to file the vector which passed its logic operation
// i cannot access x which is pointed to the arrayOfUsers
// ASSUMING that the operations have just passed on vector index 2,
//I cannot access it here so to write it on a file, if i dont write
//it here, it will perform the operations on vector 3
}
}