-
June 2nd, 2014, 03:53 AM
#1
How to initialize QMap
how to initialize a QMap<QString,int> like following?
Code:
map<string, int> m = {{"aa", 1}, {"bb",2}};
-
June 2nd, 2014, 05:44 AM
#2
Re: How to initialize QMap
1) What version of Qt are you using? constructor using am initializer list started with 5.1
2) what operating system ? If Linux, and using g++, you need instruct g++ to use C++11
Add to the pro file:
unix {
QMAKE_CXXFLAGS += -std=c++0x
}
-
June 2nd, 2014, 08:12 PM
#3
Re: How to initialize QMap
I am using Qt 5.2.1 with visual studio 2012
I can't seem to be able to do that
The compiler error :
1 IntelliSense: initialization with '{...}' is not allowed for object of type "QMap<QString, int>"
Last edited by mce; June 2nd, 2014 at 08:17 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|