g++ isn't bad at all, but sometimes its error messages may be quite confusing/cryptic. On Aug 23, 2013 8:39 PM, "Mandeep Sandhu" <mandeepsandhu....@gmail.com> wrote:
> >> Error from Clang: >> >> error: template argument for template type parameter must be a type; did >> you forget 'typename'? >> > > It' right, in that I need to use typename 'somewhere', I just didn't know > where (and why). > > I finally fixed it doing a typedef of this dependent type, which also > makes it easy to type! :) > > > template <typename K, typename V> > class TemplateTest > { > typedef typename QLinkedList<V>::iterator iter; > > public: > TemplateTest() > { > QHash<K, iter > h; > Q_UNUSED(h); > } > ... > > There's a nice explanation about 'typename' keyword here: > http://pages.cs.wisc.edu/~driscoll/typename.html > > >> Note: use proper compiler next time. >> > > Note: Using g++, which is a _very_ proper compiler. It even has a > "-pedantic" switch! ;) > > $ g++ --version > g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 > > Regards, > -mandeep > > >> >> > Error: >> > >> > templatetest.h:13: error: type/value mismatch at argument 2 in template >> parameter list for 'template<class Key, class T> class QHash' >> > templatetest.h:13: error: expected a type, got >> 'QLinkedList<V>::iterator' >> > templatetest.h:13: error: invalid type in declaration before ';' token >> > >> > However, if I keep the value as a QList (remove iterator) it compile >> fine. >> > >> > Whats the problem with storing a Iterator as the value? >> > >> > Thanks, >> > -mandeep >> > >> > , >> > _______________________________________________ >> > Interest mailing list >> > Interest@qt-project.org >> > http://lists.qt-project.org/mailman/listinfo/interest >> >> >> -- >> Regards, >> Konstantin >> > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest