的含義:[2]用於什麼? 我明白「點」是2D點的矢量,但我不明白「[2]」的好處![int]在下面的代碼中聲明向量
vector<CvPoint2D32f> points[2];
或
vector<string> imageNames[2];
或
vector<CvPoint2D32f> temp(10);
,是什麼溫度(10)和其他類型的括號之間的區別?
的含義:[2]用於什麼? 我明白「點」是2D點的矢量,但我不明白「[2]」的好處![int]在下面的代碼中聲明向量
vector<CvPoint2D32f> points[2];
或
vector<string> imageNames[2];
或
vector<CvPoint2D32f> temp(10);
,是什麼溫度(10)和其他類型的括號之間的區別?
您正在聲明矢量的陣列< CvPoint2D32f>
點[0]是一個矢量< CvPoint2D32f>
點[1]是矢量< CvPoint2D32f>
在這一行
vector<CvPoint2D32f> points[2];
你聲明一個長度爲2的向量數組。
points[0]
和points[1]
是CvPoint2D32f
的vectors
。
在線路
vector<CvPoint2D32f> temp(10);
聲明含有CvPoint2D32f
類型的10個元件中的一個向量。
'points'是一個包含兩個'vector'的數組。與'int twoInts [2];'一樣,聲明一個包含兩個int的數組。 –
這在任何介紹性的C++書籍中,分別在關於數組和向量的章節中都有介紹。 – molbdnilo