/* Lecture code 12.0
 *
 * Using the <functional> library to count large elements in a vector<int>.
 */

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <functional>
using namespace std;

const int NUM_INTS = 10000;

bool GreaterThan(int one, int two)
{
	return one >= two;
}

int main()
{
	vector<int> myVector;
	for(int i = 0; i < NUM_INTS; i++)
		myVector.push_back(rand());

	cout << count_if(myVector.begin(), myVector.end(), bind2nd(ptr_fun(GreaterThan), 137)) << endl;
	/* NOTE: Could also use
	 * bind2nd(greater_equal<int>(), 137) - See the handout.
	 */

	return 0;
}