ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In file included from label.h:9,
from label.cpp:1:
vectorgrid.h: In member function `T* VectorGrid<T>::getObject(int, int)':
vectorgrid.h:42: warning: `std::vector<T, std::allocator<_CharT> >::iterator'
is implicitly a typename
vectorgrid.h:42: warning: implicit typename is deprecated, please see the
documentation for details
What should I change to get rid of these warnings?
My program compiles though and seems to work fine.
I can't test it with int. The class would not make any sens.
I think there is something wrong with the way I declare an iterator for a vector that involves templete type.
The warning says 'it is implicitly a typename'. But how do I make it explicit? Maybe it needs some kind of qualifier.
for what I've read you need to make explicit declaration of the typename:
typename vector<T>::iterator it;
Correct. This is only required within a template. The reason for this is that during the initial pass of the parser both templates (yours and std::vector) are incomplete types; there could be a partial specialization for vector <T> later on where ::iterator could be a function or a data member instead of a typedef in that specialization. The 'typename' tells the compiler that this will be a typename in the class vector<T> after all specializations are made (or aren't made). Even though "all" compilers are smart enough to figure this out, it's standard C++ and it makes your code a little bit more clear.
ta0kira
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.