STL iterator problems

I can't seem to make the STL iterator class work how I need it to.

I am implementing a multi list graph and I need to iterate through my STL list of Vertex pointer objects. I keep getting the error:

Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_List_iterator<_Mylist>' (or there is no acceptable conversion)

and the same for != for my terminating condition.

1
2
3
4
5
6
7
8
9
10
11
template <typename V, typename E>
void Graph<V, E>::InsertEdge(V from, V to, E edge)
{
	list<Vertex<V>*>::iterator iter;

	for(iter = m_Vertices.begin(); iter != m_Vertices.end(); ++iter)
	{

	}
}
#endif 


any help is appreciated! thanks
Last edited on
The only assignmemt I can see is initialising iter in the for loop.

Why are you not using RAII? As in:
1
2
3
4
for (std::list<Vector<V>*>::iterator iter = m_Vertices.begin(); iter != m_Vertices.end(); ++iter)
{
	//
}


But you haven't given a line number so ...
RAII ?

my error is line 6... For some reason I'm having trouble getting the iterator to accept my Data type as valid...

the binary scope res operator says "No members available on line 4". so I just typed it in anyway and it doesn't work. I'll try your way kbw..

Also I fixed an error in my original post. I had the data type as Vector when it should've said Vertex, my own class.

Topic archived. No new replies allowed.