M
mkarja
Hi,
I'm having a bit of a problem with auto_ptr.
Here's a code snippet and some explanation to follow.
Communicator.h
-------- code start --------
typedef OsCommunication osCom;
private:
std::auto_ptr<osCom> m_osCom;
-------- code end --------
Communicator.cpp
-------- code start --------
void Communicator::Initialize(void *ptr)
{
if(ptr != 0)
g_ServerWorker = (ServerWorker*)ptr;
else
try
{
m_osCom->Initialize(this);
}
catch(...)
{
}
}
-------- code end --------
There are obviously lots of other stuff on both files, but those are
the essential
parts I think.
The OsCommunication is an abstract class that's why I use typedef and
auto_ptr.
If someone has better idea for that, I'm all ears.
The "m_osCom->Initialize(this);" line is what causes the error when I
debug it.
The error is somthing like this "Debug Assertion Failed, auto_ptr not
dereferencable"
Any help would be greatly appriciated.
I'm having a bit of a problem with auto_ptr.
Here's a code snippet and some explanation to follow.
Communicator.h
-------- code start --------
typedef OsCommunication osCom;
private:
std::auto_ptr<osCom> m_osCom;
-------- code end --------
Communicator.cpp
-------- code start --------
void Communicator::Initialize(void *ptr)
{
if(ptr != 0)
g_ServerWorker = (ServerWorker*)ptr;
else
try
{
m_osCom->Initialize(this);
}
catch(...)
{
}
}
-------- code end --------
There are obviously lots of other stuff on both files, but those are
the essential
parts I think.
The OsCommunication is an abstract class that's why I use typedef and
auto_ptr.
If someone has better idea for that, I'm all ears.
The "m_osCom->Initialize(this);" line is what causes the error when I
debug it.
The error is somthing like this "Debug Assertion Failed, auto_ptr not
dereferencable"
Any help would be greatly appriciated.