push_back中的2个参数

我试图使用push_back在向量中放入2个参数,但它给我一个错误,因为该函数只允许一个参数。我怎么能传递2个参数? 顶点类:
template <class VertexType, class EdgeType> class Vertex{
public:
std::vector<std::pair<int, EdgeType>> VertexList;
};
Main()内的Vertex类外:
project3::Vertex<string, string> v1("v1");
v1.VertexList.push_back(1,"e1");
错误是: 错误C2661:'std :: vector&lt; _Ty> :: push_back':没有重载函数需要2个参数 IntelliSense:函数调用中的参数太多     
已邀请:
你需要这样做
v1.VertexList.push_back(std::pair<int, EdgeType>(1,"e1"));
    
尝试push_back(make_pair(1,string(“e1”)));     

要回复问题请先登录注册