Define your object function like this:
Code:
class All {
public:
All(char ch): mov_(ch) { }
bool operator()(const char ch) { return ch == mov_; }
private:
char mov_;
};
Then you just need to define your predicate function accordingly.
If you write 1's for people entering you use count_if as:
Code:
int arrived = std::count_if(std::istreambuf_iterator<char>(f),
std::istreambuf_iterator<char>(),
All('1'));
if you write 0's for people leaving you use count_if as:
Code:
int left = std::count_if(std::istreambuf_iterator<char>(f),
std::istreambuf_iterator<char>(),
All('0'));