why it works only if the second argument is greater than 3. And how can I fix it? if I do the same with copy_if it works! Task: Examine the effect of the functor std :: bind. Try using it to form the conditions of the standard functor std :: greater ( module).
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <iterator>
#include <string>
#include <functional>
using namespace std;
template<typename T>
static void PrintVector(const std::vector<T> &v)
{
for (auto iterator = v.begin(); iterator != v.end(); ++iterator)
{
std::cout << *iterator << " ";
}
std::cout << std::endl;
}
int main()
{
std::cout << "Task_3: greater with std::bind\n";
ostream_iterator<int> out_it(cout, " ");
vector<int> v = { 1, 8, 7, 4, 3, 6, 2, 5 };
PrintVector(v);
auto greater_binded = bind(greater<int>(), placeholders::_1, 3);
sort(v.begin(), v.end(), greater_binded);
PrintVector(v);
return 0;
}