[問題] compare function 與 search key

看板C_and_CPP (C/C++)作者 (...)時間16年前 (2010/04/21 13:48), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
int a[10] = {0}; bool cmp(const int& i, const int& j) { cout << j << endl; return i < j; } int main() { int key = 99999; lower_bound(a, a+10, key, cmp); return 0; } 請問compare function裡面的第二個參數 是不是永遠都會是search key的值? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.115.154.208

04/21 14:28, , 1F
那要看lower_bound是怎麼implement的
04/21 14:28, 1F

04/21 15:08, , 2F
意思是說spec沒有規定囉?
04/21 15:08, 2F
文章代碼(AID): #1Bpf79gc (C_and_CPP)
文章代碼(AID): #1Bpf79gc (C_and_CPP)