I'm trying to pass the iterator to a separate function to then do something with the element at that location in the list.
This is not working for me.
#include <list>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
void doSomething(iterator::<int> *it);
list<int> intList;
intList.push_back(10);
intList.push_back(20);
intList.push_back(10);
intList.push_back(30);
list<int>::iterator it;
for (it = intList.begin(); it != intList.end(); it++)
{
if (*it == '10')
doSomething(*it);
};
void doSomething(iterator <int> *it)
{
(*it) = 200;
};
}