R
Ralph
Hi,
I was wondering how to get the following working. I know std::auto_ptr
does something similar but how ?
Thanks,
Ralph.
class Test
{
public:
Test() : m_b(true) {};
// copy constructor which resets the object beeing copied
Test(Test &t) : m_b(t.m_b) { t.m_b = false; };
bool get() const { return m_b; };
private:
bool m_b;
};
Test f()
{
// this will not compile...
return Test();
}
I was wondering how to get the following working. I know std::auto_ptr
does something similar but how ?
Thanks,
Ralph.
class Test
{
public:
Test() : m_b(true) {};
// copy constructor which resets the object beeing copied
Test(Test &t) : m_b(t.m_b) { t.m_b = false; };
bool get() const { return m_b; };
private:
bool m_b;
};
Test f()
{
// this will not compile...
return Test();
}