Question: So based on other examples I've found, I'm led to believe that this would be the proper code to iterate over m\_vect:

```
for(vector<T>::iterator it = m_vect.begin(); it != m_vect.end(); ++it)

```

However, upon attempting to compile, I get the following error on that line:

```
heap.h:167:6: error: need ‘typename’ before ‘std::vector<T>::iterator’ because ‘std::vector<T>’ is a dependent scope

```

Like I said, I copied and adapted the line from another piece of code, so I'm really not sure what I'm doing right and wrong. Any insight?

To clarify, this is in a template function, and I have declared 'template '. m\_vect is of type vector. Aaaand I don't know how to display less than and greater than properly...

Answer: 
Thankfully in C++11 you can just have the compiler figure it out. The compiler already knows what m\_vect is, so you can tell it:

```
for (auto it= m_vect.begin(); ( it != m_vect.end()) ; ++ it ) { }

```

But wait, there's more. In c++11 you can even just iterate over everything in `m_vect`

```
for (auto it : m_vect ) { }

```

Can you tell that I think iterating in C++03 was insane and I never saw anybody do it in real life, and in C++11 it is a thousand times better?
This is something compilers are enforcing better now.

When you are using something derived from a template, you have to flag if it's being used as a type by adding `typename`. Then if the compiler knows that (for some insane reason) `vector<T>::iterator` is a method, it can immediately flag the error instead of heading into undefined behavior.

So just add `typename` like the message says:

```
for(typename vector<T>::iterator it = m_vect.begin(); it != m_vect.end(); ++it)

```