我使用與主要作爲現在time.h中定義的「以舊換新結構」的地圖鍵時,我使用 聲明it=HashTime.find(tm structure object);
它是迭代器,然後我收到錯誤,如:使用結構作爲地圖
no match for
'operator='
in'((const CTime*)this)->CTime::HashTime.std::map<_Key, _Tp, _Compare, _Alloc>::find [with _Key = tm, _Tp = long int, _Compare = CTime::compare, _Alloc = std::allocator<std::pair<const tm, long int> >, std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const tm, long int> >, key_type = tm](((const std::map<tm, long int, CTime::compare>::key_type&)((const std::map<tm, long int, CTime::compare>::key_type*)m_ntmDate))) = m_datesec'
什麼的'it'和'HashTime'類型?如果你使用'auto it = HashTime.find(...);'? – PeterT 2012-02-03 06:43:43
你能發表一個最簡單的例子嗎? – 2012-02-03 08:25:04
其實我對C++有點新,所以這是我編碼的 – 2012-02-03 09:55:50