문제

I am trying to use this code in my QT app

QMap<QString,QMap>

but there is a build problem it says

C:/****/****/****/***/domparser.h:14: error: type/value mismatch at argument 2 in template parameter list for 'template<class Key, class T> class QMap'
도움이 되었습니까?

해결책

QMap is a template class, so you need to specify the type of the inner QMap like this :

QMap<String, QMap<QString, int> > myMap;

Note the space between the '>'s otherwise the C++ lexer thinks its the >> operator.

[edited]

If you intended to try to store a generic QMap as the value type, rather than a concrete instance of QMap, within your outer map, you can't!

You cannot have something like QMap, because QMap itself is not a type, its a template - it only names a type when the template parameters are specified

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top