A
Angus
I have a function called subscribe which passes a pointer to a
'subscribing' object to a class which will call functions on this
object.
Here is the function:
void CEventSelect::subscribe(CEventSelect* user)
{
m_subscriber = user
m_coll.push_back(user);
}
I declare this member like this:
CMySubscriber* m_subscriber;
If I copy using = in this way, m_subscriber becomes invalid as soon as
the subscribe function finishes.
If I put object in eg a vector then it works fine. Because I suppose
vector is doing a proper copy. How would I do a sim,ilar copy without
having to use a vector?
'subscribing' object to a class which will call functions on this
object.
Here is the function:
void CEventSelect::subscribe(CEventSelect* user)
{
m_subscriber = user
m_coll.push_back(user);
}
I declare this member like this:
CMySubscriber* m_subscriber;
If I copy using = in this way, m_subscriber becomes invalid as soon as
the subscribe function finishes.
If I put object in eg a vector then it works fine. Because I suppose
vector is doing a proper copy. How would I do a sim,ilar copy without
having to use a vector?