My code worked fine untill I added some mutexes to the interface IPackage class. Now in the Package class, when I try to store::IPackage P = *(new store::Package(args))
I get store::IPackage::IPackage(const store:IPackage&) (declared implicitly) Function cannot be referenced as it is a deleted function
Taking the mutexes out fixes the issue.. I'm still very new to C++. Is there any way to make this work? I don't think I could explictly define IPackage constructor as it's meant to be "hidden" in the interface.
relevant code:
IPackage.h
class IPackage {
public:
virtual ~IPackage() {}
void SetTextDataPtr(std::vector<std::string>* _ptr);
STORE_API std::vector<std::string>* GetTextDataPtr();
std::mutex m_mutex_text_data_ptr;
...
}
...
.
IPackage.cpp
void store::IPackage::SetTextDataPtr(std::vector<std::string>* _ptr) {
std::lock_guard<std::mutex> lock(m_mutex_text_data_ptr);
m_text_data_ptr = _ptr;
}
STORE_API std::vector<std::string>* store::IPackage::GetTextDataPtr() {
//std::lock_guard<std::mutex> lock(m_mutex_text_data_ptr);
return m_text_data_ptr;
}
...
.
Package.h
class Package : public IPackage { //contains one .txt and one .jpg file
public:
Package(const std::filesystem::path &_parent_path, const std::string &_package_name, STORE_ERROR &_error);
};
...