ARTICLE AD BOX
I have a class where a private data member is a Map where the value is a polymorphic object, and thus specified with a std::unique_ptr. Similar to other members I provide getters/setters for this member.
class Path { private: std::map<std::wstring, std::unique_ptr<PathItem>> items; //... public: // Getters/setters for members std::map<std::wstring, std::unique_ptr<PathItem>> getItems() const; void setItems(const std::map<std::wstring, std::unique_ptr<PathItem>>& items); //... };CPP
std::map<std::wstring, std::unique_ptr<PathItem>> Path::getItems() const { return items; } void Path::setItems(const std::map<std::wstring, std::unique_ptr<PathItem>>& items) { this->items = items; }I don't even use the class Path anywhere in the code at the moment. But on compilation I get the error
'std::construct_at': no matching overloaded function foundFrom looking around I can see that it's related to using std::unique_ptr in collections (link). But I'm not placing any entries to this collection, I don't do any push_back or emplace. All I have is class declarations by themselves and direct assignments/returns.
Is it even OK to have getters/setters for these type of data members in the first place, and how are they handled in such cases?
