[問題] c++ pair與map相關錯誤
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux ubutu 11.04
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
no
問題(Question):
程式碼的第83行和第87行註解的話可以compile成功
若不註解的話變會死掉 我的function使用應該沒有錯誤...
所以想請問一下這個bug的成因為何?
餵入的資料(Input):
no
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
code 內有結果
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h:
In member function 'bool std::less<_Tp>::operator()(const _Tp&, const _Tp&)
const [with _Tp = Data]':
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/boost_concept_check.h:358:
instantiated from 'void __gnu_cxx::_BinaryFunctionConcept<_Func, _Return,
_First, _Second>::__constraints() [with _Func = std::less<Data>, _Return =
bool, _First = Data, _Second = Data]'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:105:
instantiated from '__gnu_norm::map<Data, int, std::less<Data>,
std::allocator<std::pair<const Data, int> > >'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/debug/map.h:45:
instantiated from '__gnu_debug_def::map<Data, int, std::less<Data>,
std::allocator<std::pair<const Data, int> > >'
t.cpp:62: instantiated from here
Line 226: error: no match for 'operator<' in '__x < __y'
compilation terminated due to -Wfatal-errors.
程式碼(Code):(請善用置底文網頁, 記得排版)
http://codepad.org/qM0Sw5te
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.168.79.153
→
05/03 01:31, , 1F
05/03 01:31, 1F
→
05/03 01:35, , 2F
05/03 01:35, 2F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章