In the code below, is there any way that I can pass an argument to the demo constructor when using std::make_unique() to allocate a demo[] array?
class demo{
public:
int info;
demo():info(-99){} // default value
demo(int info): info(info){}
};
int main(){
// ok below code creates default constructor, totally fine, no problem
std::unique_ptr<demo> pt1 = std::make_unique<demo>();
// and this line creates argument constructor, totally fine, no problem
std::unique_ptr<demo> pt2 = std::make_unique<demo>(1800);
// But now, look at this below line
// it creates 5 object of demo class with default constructor
std::unique_ptr<demo[]> pt3 = std::make_unique<demo[]>(5);
// but I need here to pass second constructor argument, something like this : -
//std::unique_ptr<demo[]> pt3 = std::make_unique<demo[]>(5, 200);
return 0;
}