我想使用对作为参数传入的向量的引用。我怎么能这样做?
static void sort(polygon2D& poly) {
vector<point2D> t = poly.m_vPoint2D;
/* the rest doesn't matter */
}
答案 0 :(得分:2)
以下是创建参考的方法:
vector<point2D>& t = poly.m_vPoint2D; // here
const int n = (int) t.size(); // Call size() on the reference you have