list<char>::iterator FindIterator,newEnd;
FindIterator = find(cList.begin(), cList.end(), 'c');
if (FindIterator == cList.end())
{
printf("not find the char 'c'!");
}
else
{
printf("%c", * FindIterator);
}
newEnd = cList.remove(cList.begin(), cList.end(), 'c');
cNum = count(cList.Begin(), cList.end(), 'c'); //统计list中的字符b的个数
#include <algorithm>
class IsC
{
public:
bool operator() ( char& ch )
{
return ch== 'c';
}
};
int numC = count_if (cList.begin(), cList.end(),IsC());