Here is my piece of code:
class Model;
class Resources
{
public:
Resources() :
initialized(false)
, pathToSkyBoxModel("E:\\C++\\OpenGLtutorial\\resources\\cube.obj")
{};
void Init(const ShaderProgram& shaderProgram);
/* Setters */
void SetSkyBoxModelPath(std::string&& newPath) { pathToSkyBoxModel = newPath; };
/* Getters */
bool IsInitialized() const noexcept { return initialized; };
const std::string& GetPathToSkyBoxModel() const noexcept { return pathToSkyBoxModel; };
DiffuseTexture default_texture;
TransparentTexture default_transparent_texture;
private:
std::unique_ptr<Model> pModel;
bool initialized;
};
I am trying to avoid circular dependency by using std::unique_ptr for Resource class member pModel. Unfortunately, I get compilation error like: "You can't use here partly defined class". But it works for std::shared_ptr and common pointer. What's wrong with std::unique_ptr ?