While I myself was familiar with the C ++ 14 specification, I read that if the class does not have an explicitly declared Copy Constructor, copy assignment operator, Move Constructor or Move Assignment Operator, the default implementation should be generated by the compiler.
Consider this empty class for streaming security files:
class ThreadSafeFile
{
std::mutex m_mutex;
std::string m_FileName;
std::ofstream m_File;
};
When I try to move it like this:
ThreadSafeFile file;
ThreadSafeFile file2 = std::move(file);
I get this compilation error:
function "ThreadSafeFile :: ThreadSafeFile (const ThreadSafeFile &)" (declared implicitly) cannot be referenced - this is a remote function
Why is this so?
source
share