0

Possible Duplicate:
Question about vector iterator in template functions

I have a template class which contains a vector of another template class (Flare::Functor). I declare my vector of Flare::Functor*s like this:

template<typename T, typename U = void, typename V = void>
class Signal
{
public:
    ...
    std::vector<Flare::Functor<T, U, V>*> handlers;
}

This works fine, however when I try to iterate over the vector (in another function), like this:

void raise(U arg1, V arg2)
{
            for (std::vector<Flare::Functor<T, U, V>*>::iterator it = handlers.begin(); it < handlers.end(); ++it)
                ...
}

gcc gives these errors:

include/signal.h: In member function ‘void Flare::Signal<T, U, V>::raise(U, V)’:
include/signal.h:31: error: expected `;' before ‘it’
include/signal.h:31: error: ‘it’ was not declared in this scope

Declaring the iterator like this:

std::vector<Flare::Functor<void, void, void>*>::iterator it

seems to work perfectly fine though.

Community
  • 1
  • 1
ProtoSphere
  • 209
  • 3
  • 9

0 Answers0