????在結構體“struct”的定義中有“bool operator<(const Edge&a)const{return w>a.w;}”的語句航瞭,其實并不知道這是干什么的,所以就改了改其中的一些內容渐裸,試試錯,下面是我的試錯結果:
? ? 這句重載語句,如果格式錯誤近忙,dev-cpp就會打開一個頭文件“stl_function.h”,并會定位至371行左右的位置田晚,那一塊的語句是這樣寫的:
試錯
我嘗試了以下語句嘱兼;都會報錯:
“bool operator()(const Edge&a)const”;
“bool operator>(const Edge&a)const”;
"bool operator>(Edge&a)const";
“bool operator>(const Edge&a)”;
只有當“operator”后面跟的是“<”才不會報錯,而在本程序中贤徒,我想要讓邊權值小的在前芹壕,所以在下面語句就是“return w>a.w;”