It's for University and I'ma bit stuck. The lecturer must have issues with me because he refuses to answer my emails for help so I'm hoping someone here can help!
I have a C++ class that is like this;
class Vertex{
public:
Vertex () {}; // Constructor
~Vertex () {}; // Destructor
Vertex& build(int);
std::vector<Vector4> shape; // Coordinates of object in each space
std::vector<Vector4> shapeW;
std::vector<Vector4> shapeV;
std::vector<Vector4> shapeP;
std::vector<Vector4> shapeS;
};
Vertex& Vertex::build(int i)
{
shape.resize(i);
shapeW.resize(i);
shapeV.resize(i);
shapeP.resize(i);
shapeS.resize(i);
return *this;
}
and a Vector4 class that is like this;
class Vector4{
private:
float c[4];
public:
//constructors
Vector4(float x=0., float y=0., float z=0., float h=1); //default
};
Vector4::Vector4(float x, float y, float z, float h)
{
c[0] = x;
c[1] = y;
c[2] = z;
c[3] = h;
}
And what I have declared as a global variable is this;
std::vector<Vertex> object;
Which SHOULD be a C++ vector of vectors. The problem I have is when the code tries to reserve memory for the shape.resize(i); part in the build member fuction I get a Visual C++ Assertation error...
quote:
Debug Assertation Failed!
Program: filename.cpp
File: dbgheap.c
Line: 1011
Expression: _CrtIsValidHeapPointer(pUserData)
for more information on how your program can cause assertation errors.... etc etc.
Abort Retry Ignore
If anyone knows what I'm going on about then PLEASE help me because this is very important. I can't see why the code will not work
Thanks. If you need any more information then please let me know!
Aarrrrrrrggggghhhhhh!!!!!
Edited by - Real World on August 9, 2001 10:43:23 AM