my understanding is that greater_equal<double> is a functor that has a signature of function<bool (double, double)>, so I have tried to perform the following,
#include <functional>
#include <memory>
using namespace std;
int main() {
std::shared_ptr<std::function<bool (double, double)>> f;
auto f1 =make_shared<greater_equal<double>>();
auto f2 = make_shared<less_equal<double>>();
f = f1;
}
To my surprise this wont compile because,
'': cannot convert from 'const std::shared_ptrstd::greater_equal<double>' to 'std::shared_ptr<std::function<bool (double,double)>>'
I am not sure why,
what I need is similar to the spirit in the above snippet, I will have a member field of function, std::shared_ptr<std::function<bool (double, double)>> and I need to assign either <greater_equal<double> or less_equal<double> base on some condition, how should I achieve this?