我正在尝试创建一个元组,在其中我将有一个函数,该函数接受一个生成器并返回一个双精度值。
我仍然很难实现它。
到目前为止,我正在尝试使这样的线路有效:
auto g = boost::random::uniform_real_distribution<>().operator()<boost::random::mt19937>;
理想情况下使用它
#include <boost/random.hpp>
main()
{
//I want to see all boost distribution as std::function<double(boost::random::mt19937)>
auto g = boost::random::uniform_real_distribution<>().operator()<boost::random::mt19937>;
boost::random::mt19937 f(0);
double x = g(f);
}
我遗漏了一些东西(肯定是 operator() 是模板化的事实),但我不明白为什么它不能在自动上编译。