I am trying to get exakt value my iterator is pointing at out of 2d array.
I have a 2d array and with max_element I got the maximum out of the values in the array.
With a "1d" iterator you can dereference the iterator and get the value (*iteratorOneD). But how can I do something like this with an 2d iterator like here:
vector<vector <int>>::iterator position; position = std::max_element(Data.begin(), Data.end()); int max = *position; cout<< *position << endl;
I tried a few things like this. But nothing worked yet. I receive this error.
C2440 "Initialisierung": "std::vector<int,std::allocator>" cant be converted to an int
The output of
cout << *position << endl; is
I would like to be able to assign one of these values to
Thanks in advance.
Source: Windows Questions C++