My class contains a unique pointer to an array. When the copy constructor is called, I want the class to create its own unique array of pointers and just copy the contents of the old unique array of pointers. I keep getting errors regarding the conversion from the const value, and I'm not sure how to get around it.
My pointer is declared private:
std::unique_ptr<Manager[]> managers;
I planned to just skip the array and copy manually, so I created this copy constructor:
Restaurant::Restaurant(const Restaurant &_r)
{
Manager *_managers = _r.managers;
for (int i = 0; i < MAX_MANAGERS; i++)
{
managers.get()[i] = _managers[i];
}
}
It gives a const conversion error on this line:
Manager *_managers = _r.managers;
I just want to make a deep copy. How can I do this to make this work?