I have problem where I want to create a std::uniform_int_distribution
in a struct and then give its range later. Below is what I want.
#include
You can just do
group.dis = std::uniform_int_distribution<>(0,19);
or
group.dis.param(std::uniform_int_distribution<>::param_type(0,19));
Another way would be to add a method to your struct
struct group_s {
int k;
std::uniform_int_distribution<> dis;
void set(int a, int b) { dis = std::uniform_int_distribution<>(a,b); }
} group;
group.set(0,19);