I have a struct that only has double member variables, e.g.
struct foo { double a, b, c; };
Another class has a std::vector<foo> v
member that calls the std::vector<foo>::vector(size_t)
constructor in the initializer list.
What I'd like to do is write a default constructor for foo
so that all the doubles in it are initialized to zero, without having to write
foo(): a(0), b(0), c(0) { }
I keep needing to add more variables to foo
, but it doesn't make sense to have them be elements of a container like std::array<double>
, because they all serve distinct purposes.