Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果你有类似的东西vector<pair<int, int> > one,one.push_back(make_pair(1,2))如果我声明另一对,我pair<int, int> thisOne怎样才能使它等于从向量中弹出的向量元素?
vector<pair<int, int> > one
one.push_back(make_pair(1,2))
pair<int, int> thisOne
要比较std::pair,您可以只使用对比较运算符,它定义了所有比较运算符:
operator==,!=,<,<=,>,>=(std::pair)
什么元素从向量中弹出,你还没有说任何关于弹出的内容。
也许你想要:
thisOne = one.back();