I have the following function that should return a distribution generateor such that I can use the function to populate a vector i.e.
template
You can use boost::function<>
(or even std::function<>
):
Live On Coliru
#include <boost/math/distributions.hpp>
#include <boost/function.hpp>
#include <boost/random.hpp>
#include <random>
static boost::mt19937 gen;
typedef boost::function<double()> Distri;
Distri new_func()
{
std::uniform_real_distribution<> Uni(1,2);
return boost::variate_generator< boost::mt19937, std::uniform_real_distribution<>>(gen , Uni);
}
int main ()
{
std::vector<double> test;
//something like
Distri d = new_func();
//likely
std::generate_n(back_inserter(test), 100, d);
}