I have some objects of a same class in an array that was pointed by a unique_ptr, and each object can only be created with the explicit constructor, since a few of arguments must be passed to the constructor.
When initializing, I'm going to create such a unique_ptr as following:
unique_ptr<ClassA [ ] > arrayA = make_unique<ClassA [ ]>(100, some args to be passed );
But it looks like there is no version of make_unique can do so as above. According to docs: If make_unique is making a array, it only takes one argument that is the size of the array.
I can not use vector in this scenes, as the ClassA is a message queue that is being shared by multiple threads(productors/cosumers), while vector will move elements to a new place if the space is insufficient.
Is there another way, in it I can make a array of a class that has only explicit constructor? At same time, I still want to use unique_ptr to manage them.
Thanks!