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: 
This appears to be in a template function, and `vector<T>::iterator` is a type which is dependent on `T`, which is a template parameter. Since templates can be specialized with unique definitions for any different type, the compiler has no way of being sure, until the template is actually instantiated, whether `vector<T>::iterator` is a type, or a static member. If it is a static member, this does not make any sense, syntactically:

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

```

What you need to do is tell the compliler that `vector<T>::iterator` is a type. Use `typename` for that:

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

```

If you read your error, you can see that this is exactly what your compiler is telling you.
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)

```