The dynamically created array of objects need to use a non-default constructor, and the problem I\'m running into I think is the syntax. In my mind, the fact that I\'m able
new
expression allows only default initialization, you can not do this within single new
expression. What you could do is allocate raw memory and construct objects one by one using placement new (see this answer in Object array initialization without default constructor)
Or yet even better, don't use C-style arrays. Instead, use some STL container such as std::vector
and it's constructor, where the 2nd argument is a value that will be used to initialize elements:
std::vector integers(5, IntegerSet(this->getLength()) );