Here is my question.
private:
map<string,int &> days;
int daysHours[6] = {};
I have private
data like this.
void Schedule::studentSchedule()
{
getDays().insert(pair<string, int&>("Monday", daysHours));
getDays().insert(pair<string, int& >("Tuesday", daysHours));
getDays().insert(pair<string, int&>("Wednesday", daysHours));
getDays().insert(pair<string, int& >("Thursday", daysHours));
getDays().insert(pair<string, int&>("Friday", daysHours));
map<string, int&>::iterator it;
for (it = getDays().begin(); it != getDays().end(); ++it)
{
cout << "Day: " << it->first << "\tHours: " << it->second << endl;
}
}
I this function I want to create a map with days and empty array.
When I do that I am getting an error like this.
error: no matching function for call to 'std::pair<std::__cxx11::basic_string<char>, int&>::pair(const char [7], int [6])'
getDays().insert(pair<string,int &>("Monday",daysHours));
Can you help me about that?
Aucun commentaire:
Enregistrer un commentaire