I don't have a lot of experience with unique_ptrs yet, and I'm having a tough time determining why I get this error message:
error C2664: 'IFCC::IFCC(const IFCC &)' : cannot convert argument 1 from 'std::unique_ptr>' to 'IFO *' \Microsoft Visual Studio 12.0\VC\include\memory
This is the code that I think is causing this compilation error:
IFP.cpp:
std::unique_ptr<IFCC> IFPage::getIFCC()
{
return(make_unique<IFCC>(m_IFCC)); //recent add that is probably causing issue
}
IFP.h:
public:
std::unique_ptr<IFCC> getIFCC();
private:
unique_ptr<IFCC> m_IFCC = nullptr;
For some reason the error mentions IFO, which is the heirarchical parent of IFP. Also, IFCC has a parent of IFCCB, and both IFCC and IFCCB take a parameter of IFO. If I'm just making a new unique_ptr of IFCC, I don't think it would need the parameter that IFCC requires to make a new object, since I'm using an existing object to make it.
It's probably some syntax error that I missed somewhere. It doesn't seem like returning a value should cause issues.
I've been looking at unique_ptr info and it looks like I have what they have, but my application is more complicated. So do you have any input as to the error?
I've also seen stack overflow unique_ptr link and think that it is a different question because they are asking how it is implemented for the compiler and why, whereas my question is regarding how to implement the unique_ptr for a return value. In their question, one return statement is shown, but I am trying to use make_unique, whereas they created a new unique_ptr and used that variable as a return value.