[問題] 有關vector pointer的用法
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
vc++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
有關vector<>::pointer 傳入function 的使用方法
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
vector<int> A;
vector<int> B;
void Select(vector<int>::pointer pvector,int index)
{
switch(index)
{
case 1:
pvector=&A[0];
break;
case 2:
pvector=&B[0];
break;
}
int main()
{
//A B傳入值
...
vector<int>::pointer pv;
//這邊是ok的
pv=&A[0];
pv=&B[0];
//不過這邊要傳function 我就不知道要怎麼使用了
Select( pv,1);
return 0;
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.254.116.32
→
03/11 03:04, , 1F
03/11 03:04, 1F
→
03/11 03:05, , 2F
03/11 03:05, 2F
→
03/11 03:06, , 3F
03/11 03:06, 3F
→
03/11 03:14, , 4F
03/11 03:14, 4F
→
03/11 03:14, , 5F
03/11 03:14, 5F
→
03/11 03:15, , 6F
03/11 03:15, 6F
→
03/11 03:16, , 7F
03/11 03:16, 7F
→
03/11 07:54, , 8F
03/11 07:54, 8F
→
03/11 08:54, , 9F
03/11 08:54, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章