Reputation: 3673
I'm trying to store a QString and a bool in a vector as a pair. I keep getting the error
no matching function for call to 'make_pair(bool, QString&)' messages.push_back(make_pair(true, message));
when I run following function:
void Class::setMessage(){
QTime time = QTime::currentTime();
QString message = time.toString() + "-" + "My message";
vector<pair<bool,QString>> messages;
messages.push_back(make_pair<bool,QString>(true, message));
}
Whats missing in my code?
Upvotes: 0
Views: 505
Reputation: 4076
This should work. You don't need to specify the template parameters. They're deduced. I'm assuming you're using std. Perhaps qualify make_pair with std. Remember to include utility.
Also, make sure that the names used are declared the expected scope.
Upvotes: 2