Ok guys, I could sure use some help regarding this search methond in C++.
I have a 2D vector which i read from a text file. It looks like this:
000000000
000100001
000010000
The idea here is I have to search for the leftmost '1' in the highest possible row it is present in. I need to be able to find the first '1' in any type of text file like the one i have just shown.
so far, I have declared the iterators for the vector and tried to use the find_first_of function to find the first '1'. but to no avail. Could you please help me with this. Here's my code:
int a = 1;
vector< vector<int> >::iterator start = block.begin();
vector< vector<int> >::iterator end = block.end();
for( ; start != end ; ++start){
vector<int>::iterator rowst = start->begin();
vector<int>::iterator rowen = end->end();
for( ; rowst != rowen; ++rowst){
rowst = find_first_of(block.begin(), block.end(),vector<int>,a);
}
}
Any help would be appreciated.