I have two related questions concerning the use of distributions inside classes.
Is there some kind of base distribution in C++ in order to use a distribution as a class member without knowing which distribution it will be? I cannot use templates (see question 2)
class Foo{ private: // could by any distribution std::base_distribution dist_; };
I have another class
Bar
that should have a vector ofFoo
as a private member (std::vector<Foo>
). The problem is that ifFoo
uses templates, then it is not possible to have a vector of different template arguments which is exactly what I want to have.class Bar { private: std::vector<Foo> foo_; };
boost::variant
doesn't help either because I don't know the type of distributions. So this (for example) is not possible in my case:
class Bar{
private:
boost::variant<std::normal_distribution<>, std::uniform_real_distribution<> > dists_;
};