Adding to a vector of pair

Solution 1:

Use std::make_pair:

revenue.push_back(std::make_pair("string",map[i].second));

Solution 2:

IMHO, a very nice solution is to use c++11 emplace_back function:

revenue.emplace_back("string", map[i].second);

It just creates a new element in place.

Solution 3:

revenue.pushback("string",map[i].second);

But that says cannot take two arguments. So how can I add to this vector pair?

You're on the right path, but think about it; what does your vector hold? It certainly doesn't hold a string and an int in one position, it holds a Pair. So...

revenue.push_back( std::make_pair( "string", map[i].second ) );     

Solution 4:

Or you can use initialize list:

revenue.push_back({"string", map[i].second});