i am trying to compare 2 two dimensional vectors, both of which contain 10 cells inside every 52 lines. I am trying to compare taking first 5 lines as a reference and then compare all the other lines with those 5 lines and then most importantly save all the information (reference id and position of the cell) that exactly which cell of the reference cell was found similar with which cells of every lines. The cells which cant be found in the reference cell should be printed as it is. this is what i tried:
int main(){
vector <vector<string>> reference_one_cell; /*stored all the cells of 5 reference lines */
vector < vector<string> > input_array; /*stored all the cells all 52 lines */
/*comparison part*/
std::set<std::string> stringSet;
for ( auto const& vs : reference_one_cell)
for ( auto const& item : vs )
stringSet.insert(item);
for (int f=0;f<52;f++){
for (int g=0;g<10;g++){
bool found = any_of(stringSet.begin(),
stringSet.end(),
[=](std::string const& item){return input_array[f][g] == item;});
if ( found )
{
outputFile << ",";
}
else
{
outputFile<<input_array[f][g];
}
}
}
}
i am able to print out "," for the cells that were found in the reference lines. But really stuck for few days with how to use pointer or pair to store all the detail information( reference id and position in the reference lines) that i can go back to the original condition again. thanks in advance