N
Nichola
Hi Iam trying to learn visual C++ but I have came accross some issues,
I was hoping someone could help.
I have a linked list, in each element there is XYZ float values(point)
and a vector which holds floats.
I want to check the difference between each point in the linked list
and store this into the vector. Sounds ok, BUT I can fill the XYZ
values throughout the linked list and access them later but when it
comes to the vector the values seem to go into the structure but when
I either try to access it later or when Iam debugging the data is
gone?
I have the following code:
in CClass:
#include <vector>
using std::vector;
CClass(float x, float y, float z, vector<float> NameVector);
std::vector<float> CoVector;
In Document Function:
POSITION pos;
for (pos = m_Point.GetHeadPosition(); pos != NULL
{
CClass *point = (CClass*)m_Point.GetAt(pos);
// I get the difference value and store it in the diff variable
point->NameVector.push_back(diff);
// the diff variable holds the correct value
}// when it gets to here the value is lost?
point = (CClass *)m_Point.GetNext(pos);
I have tried to access the linked list through another function and
again I can access the XYZ values but nothing is in the vector, Why??
I have also tried to use the Vector.At() function and this still gives
me nothing.
Can anyone help me or post an example of something similar so I can
try to understand what Iam doing wrong. Is it the memory or have I not
initialised the vector?
Thanks in Advance for any help
Nic
I was hoping someone could help.
I have a linked list, in each element there is XYZ float values(point)
and a vector which holds floats.
I want to check the difference between each point in the linked list
and store this into the vector. Sounds ok, BUT I can fill the XYZ
values throughout the linked list and access them later but when it
comes to the vector the values seem to go into the structure but when
I either try to access it later or when Iam debugging the data is
gone?
I have the following code:
in CClass:
#include <vector>
using std::vector;
CClass(float x, float y, float z, vector<float> NameVector);
std::vector<float> CoVector;
In Document Function:
POSITION pos;
for (pos = m_Point.GetHeadPosition(); pos != NULL
{
CClass *point = (CClass*)m_Point.GetAt(pos);
// I get the difference value and store it in the diff variable
point->NameVector.push_back(diff);
// the diff variable holds the correct value
}// when it gets to here the value is lost?
point = (CClass *)m_Point.GetNext(pos);
I have tried to access the linked list through another function and
again I can access the XYZ values but nothing is in the vector, Why??
I have also tried to use the Vector.At() function and this still gives
me nothing.
Can anyone help me or post an example of something similar so I can
try to understand what Iam doing wrong. Is it the memory or have I not
initialised the vector?
Thanks in Advance for any help
Nic