[問題] vector iterators incompatible
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VS2010
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
在執行到Class B上的 取得Class A的m_WorkingList 會出現
vector iterators incompatible的錯誤
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
typedef struct _Working_List
{
std::wstring RowNo;
std::wstring Name;
}Working_List;
//-----class A-----//
std::vector<Working_List> m_WorkingList;
void A::InsertList()
{
for(...)
{
Working_List list;
list.RowNo = L"";
list.Name = L"";
m_WorkingList.push_back(list);
}
}
const std::vector<Working_List>& A::GetWorkingList() const
{
return m_WorkingList;
}
//------Class B------//
std::vector<Working_List> list = A->GetWorkingList();
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.135.117.32
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1464494125.A.B89.html
推
05/29 12:07, , 1F
05/29 12:07, 1F
→
05/29 12:07, , 2F
05/29 12:07, 2F
→
05/29 12:08, , 3F
05/29 12:08, 3F
→
05/29 12:08, , 4F
05/29 12:08, 4F
→
05/29 12:09, , 5F
05/29 12:09, 5F
→
05/29 12:09, , 6F
05/29 12:09, 6F
→
05/29 12:20, , 7F
05/29 12:20, 7F
→
05/29 12:20, , 8F
05/29 12:20, 8F