Hi i have a simple problem,
i keep receiving this error (see pic)
I know its something to do with passing/using a bad pointer causing the assertion to fail. Im just unsure of where this occurs, heres my code:
Heres the constructor.. and possibly occurs somewhere in here...Code:template <int size> class Compartment : public Node { public: Compartment(); ~Compartment(); Compartment* getCompartment() { return this; } void printCompartments(ofstream o); Node *find(int i); private: /*************/ /* Variables */ /*************/ Node *current; Node *head; Node *tail; /*************/ /* Methods */ /*************/ Node *getNext(void) { return current->next; } Node *getPrev(void) { return current->prev; } Node *getHead(void) { return head; } Node *getCurrent(void) { return current; } Node *getTail(void) { return tail; } int length(void) { return size; } double getReceptor(Node* n) { return n->receptor; } double getLigand(Node* n) { return n->ligand; } void setReceptor(Node *n, double conc); void setLigand(Node *n, double conc); };
Anyone got any idea where to begin? Ive debugged this constructor and it "seems" to be allocating correctly.. i have a faint feeling its with the destructor? VC++ /Win XP btwCode:template <int size> Compartment<size>::Compartment() { int count = 0; head = new Node; current = head; tail = current; current->num = count; for(int i = 0; i < size; i++) { current->next = new Node; current->next->prev = current; count++; current->num = count; current->ligand = 0.0; current->receptor = 0.0; current = current->next; } } template <int size> Compartment<size>::~Compartment() { delete head; delete current; delete tail; cout << "Compartment Destroyed" << endl; }



LinkBack URL
About LinkBacks


