I have created a functional object for my randomization needs.
I just don't know how to send it to function/methods without templates. With them its easy, just
template <typename T>
void FooTemplate (T rand)
{
int b = rand(); // OK
}
void foo (... ?)
{
int a = rand(); // how to send generator to function?
}
int main(int argc, char* argv[])
{
auto rand = std::bind(std::uniform_int_distribution<uint32_t>{20, 30}, std::default_random_engine{ std::random_device()() });
return 0;
}
void foo(std::function<int()> rand) {...}
std::function<int()>
would wrap any callable, including that manufactured by std::bind