Re: [問題] C++ Primer 3/e中文版

看板Programming作者時間18年前 (2007/03/10 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《linbaskenny.bbs@ptt.cc (傲天祥雲)》之銘言: > P.591 > int ires; > string sval1; > vector<string> svec; > //... > ires = count_if(svec.begin(), svec.end(), equal_to<string>(), sval1); > 但SGI的版本是 > template <class InputIterator, class Predicate> > iterator_traits<InputIterator>::difference_type > count_if(InputIterator first, InputIterator last, Predicate pred); > template <class InputIterator, class Predicate, class Size> > void count_if(InputIterator first, InputIterator last, > Predicate pred, > Size& n); > 第四個參數型別也不一樣 > 而具我所查到的資料 > ires = count_if(svec.begin(), svec.end(), bind2nd(equal_to<string>(), sval1)); > 請高手解答疑惑@@ 看不出來你想問的東西是什麼, 你不是已經查到正確的改法了嗎? count_if 這個部分其實是英文版的錯誤, 中文版的譯者也有把堪誤寫在網站上, 總之就是你包個 bind2nd() 在外面就可以了啊。 -- Name: Tseng, Ling-hua E-mail Address: uranus@it.muds.net School: National Tsing Hua University Department: Computer Science Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design Researching: Software pipelining for VLIW architectures Homepage: https://it.muds.net/~uranus -- ╔═══╗ ┼────────────────────────╮ 狂狷 Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮ 年少 ┼╮ < IP:140.119.164.252 > ╰─╮ ╚╦═╦╝ From:61-230-221-34.dynamic.hinet.net ─╨─╨─ KGBBS 遨翔"BBS"的狂狷不馴;屬於年少的輕狂色彩
文章代碼(AID): #15yQ3V00 (Programming)
文章代碼(AID): #15yQ3V00 (Programming)