Possible Duplicate:
What is The Rule of Three?
I just "finished" my AVL tree implementation and went to test what previously worked with a normal binary search tree. But now I am getting these assertion errors when the bsTree constructor is called.
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse) is first and if I continue windows spits the next one out. _CrtIsValidHeapPointer(pUserdata)
TYPE is defined in a type.h as Signal* I plan to change this to use templates or whatever for a polymorphic implementation but this seemed simple for initial setup.
main execution:
#include<string>
#include<iostream>
#include<fstream>
#include"binSearchTree.h"
;
using namespace std;
int main(){
string word;
int i = 0;
ifstream book ("AV1611Bible.txt");
if(book.is_open()){
book >> word;
bsTree* tree = new bsTree(new Signal(word));
while( book.good()){
book >> word;
tree->addValue(new Signal(word));
//cout << word;
cout << i++ << "\n";
}
book.close();
}
return 0;
}
bsTree Constructors:
#include"binSearchTree.h"
;
using namespace std;
bsTree::bsTree(){
root = new Node();
size = 0;
}
bsTree::bsTree(TYPE v){
root = new Node(v);
size = 0;
}
bsTree::~bsTree(){
delete root;
}
Signal constructors:
#include"signal.h"
using namespace std;
Signal::Signal(){
signal = "";
count = 0;
prob = 0;
}
Signal::Signal(string s){
Signal(s,0);
}
Signal::Signal(string s, double p){
signal = s;
count = 0;
prob = p;
}
Signal::Signal(string s, int n, double p){
signal = s;
count = n;
prob = p;
}
Signal::~Signal(){
delete(&signal);
delete(&count);
delete(&prob);
}