Adding to a vector of pair

后端 未结 10 1433
悲哀的现实
悲哀的现实 2021-01-30 05:19

I have a vector of pair like such:

vector> revenue;

I want to add a string and a doub

10条回答
  •  暖寄归人
    2021-01-30 05:35

    Try using another temporary pair:

    pair temp;
    vector> revenue;
    
    // Inside the loop
    temp.first = "string";
    temp.second = map[i].second;
    revenue.push_back(temp);
    

提交回复
热议问题