案例:在set集合中插入小寫字母,通過find去查找,而find函數區分大小寫。因此需要通過仿函數來解決 struct NoDistincyion { bool operator()(const string &str1,const
預定義函數對象 算法函數對象 加法:plus<Types> 減法:minus<Types> 乘法:multiplies<Types> 除法divides<Tpye> 求餘:modulus<Tpye> 取反:negate<Type> 關係函
函數對象:重載函數調用操作符operator()的類,其對象常稱爲函數對象。當用該對象調用此操作符時,其表現形式如同普通函數調用一般,因此取名叫函數對象。(一元函數對象) template <typename T> class Prin
for_each: 用指定函數依次對指定範圍內所有元素進行迭代訪問,可對容器的元素進行修改。 transform: 與for_each類似,遍歷所有元素,可對容器的元素進行修改。 class PrintElem { public: