so technically i am working on CList m_TrendPoints;
m_TrendPoints.GetPrev(pos );
Gets the list element identified by pos, then sets pos to the POSITION value of the previous entry in the list.
now instead of getting the point, i want to get a pointer to the point something like:
trendpoint* = &m_TrendPoints.GetPrev(pos );
now, is the above code correct, will me pointer have a life as global, if so, how to make this pointer an global array, if so how to make the global array two dimensional, so that first dimension is pen and second dimension is index and value at it is the pointer
something like trendpoint[pen][i]*, how to do this?
Re: Obtain a pointer to data inside a trend items array
Originally Posted by amara.fortheworld@gmail.com
i just gave that to shiw the looping logic i am going through:
POSITIONS are not pointers -- POSITIONS are POSITIONS. It acts like a pointer, but it isn't one. It is similar to an STL "iterator". There is no interface to turn a POSITION into a pointer because the POSITION is your "pointer".
So if you have a POSITION of something in the CList, then you have a "pointer" to what you want (even though technically, POSITIONS are not pointers).
Re: Obtain a pointer to data inside a trend items array
Originally Posted by Paul McKenzie
POSITIONS are not pointers -- POSITIONS are POSITIONS. It acts like a pointer, but it isn't one. It is similar to an STL "iterator". There is no interface to turn a POSITION into a pointer because the POSITION is your "pointer".
So if you have a POSITION of something in the CList, then you have a "pointer" to what you want (even though technically, POSITIONS are not pointers).
Regards,
Paul McKenzie
Right. As I said earlier, you can use the POSITION to hop directly to any point in the list. Then GetNext or GetPrev to move backwards or forwards.
Re: Obtain a pointer to data inside a trend items array
Originally Posted by amara.fortheworld@gmail.com
trendpoint* = &m_TrendPoints.GetPrev(pos );
now, is the above code correct, will me pointer have a life as global, if so, how to make this pointer an global array, if so how to make the global array two dimensional, so that first dimension is pen and second dimension is index and value at it is the pointer
something like trendpoint[pen][i]*, how to do this?
Re: Obtain a pointer to data inside a trend items array
Originally Posted by amara.fortheworld@gmail.com
now, is the above code correct, will me pointer have a life as global, if so, how to make this pointer an global array, if so how to make the global array two dimensional,
Your terminology is very confusing.
1) A pointer is not an array. You cannot turn a pointer into an array.
2) You now want to turn this "array" into a two-dimensional array. You can't turn a one-dimensional array into 2-dimensions without defining what you mean by turning a 1-d array into a 2-d array.
Re: Obtain a pointer to data inside a trend items array
Originally Posted by amara.fortheworld@gmail.com
continued.........
You know what might be more beneficial -- you tell us what your high-level problem is that you're trying to solve, instead of telling us how you are "solving" it and having us try to make your solution work.
That way, others can give you much better advice than trying to take what you think is a solution, and trying to make something work out of something that is unworkable.
Bookmarks