dependent scope; need typename in front;

The compiler says

my_vector.h:21:2: error: need ‘typename’ before
‘std::vector::iterator’ because ‘std::vector’ is a
dependent scope

So you need to write

typename vector< a_type >::iterator vec1_pre = vec1.begin();
typename vector< a_type >::iterator vec1_pos = vec1.begin();

See Where and why do I have to put the “template” and “typename” keywords? for the reasons behind it.

One last remark: In C++11 you can use auto and don’t have to think anymore:

auto vec1_pre = vec1.begin();
auto vec1_pos = vec1.begin();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)