D
Dean Mitchell
Hi,
I have a simple STL map container that maps a stl string to a structure as
follows.
typedef std::map<std::string,TASKLIST> PCLIST;
In a class I have a member variable that is defined as a reference to a
PCLIST;
PCLIST &m_List;
In one of the member functions I pass in a reference to another PCLIST and I
then assign this to the m_List.
void class::SetList(PCLIST &NewList)
{
m_List = NewList;
}
Now my problem is that this copies the contents of the NewList to the m_List
so I now have two distinct PCLISTs, rather than m_List being a
reference(pointer?) to the original list. How can I make m_List just point
to the original PCLIST? Am I using references correctly? or should I just
use pointers instead?
I would really appreciate someone pointing me in the right direction.
Dean Mitchell
I have a simple STL map container that maps a stl string to a structure as
follows.
typedef std::map<std::string,TASKLIST> PCLIST;
In a class I have a member variable that is defined as a reference to a
PCLIST;
PCLIST &m_List;
In one of the member functions I pass in a reference to another PCLIST and I
then assign this to the m_List.
void class::SetList(PCLIST &NewList)
{
m_List = NewList;
}
Now my problem is that this copies the contents of the NewList to the m_List
so I now have two distinct PCLISTs, rather than m_List being a
reference(pointer?) to the original list. How can I make m_List just point
to the original PCLIST? Am I using references correctly? or should I just
use pointers instead?
I would really appreciate someone pointing me in the right direction.
Dean Mitchell