I have a structure defined as
typedef struct bcurve
{
vector<CP> cpoints;
vector<int> seg;
}BEZIERCURVE;
(where CP is another structure containing the control points for a curve)
and I'm trying to get a pointer to an array of pointers to this structure.
What I have so far is:
Expand|Select|Wrap|Line Numbers
- BEZIERCURVE** allcurves = (BEZIERCURVE**)calloc(h*w,sizeof(BEZIERCURVE*));
Expand|Select|Wrap|Line Numbers
- BEZIERCURVE tempbc;
- // tempbc is passed to a function that works out what goes in the cpoints and seg fields
- allcurves[idx] = &tempbc;
I tried to get the size of the cpoints vector from allcurves[idx] and it worked fine.
But after that I need to pass allcurves to a function of another class
Expand|Select|Wrap|Line Numbers
- BEZIERCURVE** m_curves;
- int *m_imgmap;
- .
- .
- .
- void GLDraw::SetBezierCurves(BEZIERCURVE** curves, int* imgmap, int w, int h)
- {
- m_curves = curves;
- m_imgmap = imgmap;
- .
- .
- .
- // b is from a loop
- int tmp = m_curves[b]->cpoints.size();
- .
- .
- }
I'm probably doing something horribly wrong with the pointers but I'm fairly new in C++...
I'd be grateful for any suggestions..
Thanks
Tania