0

Hi

I'm trying to test my code but I keep getting some kind of strange errors

```
bst.hpp: In member function `void Bst<generic>::insert(generic) [with generic = int]':
test_BST.cpp:30: instantiated from here
bst.hpp:36: error: invalid conversion from `int' to `int*'
bst.hpp:47: error: ISO C++ forbids comparison between pointer and integer
bst.hpp:52: error: ISO C++ forbids comparison between pointer and integer
bst.hpp:58: error: ISO C++ forbids comparison between pointer and integer
bst.hpp:65: error: ISO C++ forbids comparison between pointer and integer
bst.hpp:73: error: ISO C++ forbids comparison between pointer and integer
bst.hpp:79: error: ISO C++ forbids comparison between pointer and integer
```

here is my code

bsn.h

```
struct Bsn
{
Bsn * p;
Bsn * l;
Bsn * r;
generic * data;
};
```

bst.h

```
template <class generic>
class Bst
{
public:
Bst();
~Bst();
void insert( generic x);
void remove( generic x);
generic & search ( generic x);
void clear();
bool empty();
unsigned int size();
protected:
Bsn<generic> * m_root;
Bsn<generic> * p_insert( generic x);
Bsn<generic> * p_remove( generic x);
Bsn<generic> * p_search( generic x);
private:
unsigned int m_size;
};
#include"bst.hpp"
```

bst.hpp ( my problem is only with the insert function everything else is fine)

```
template <class generic>
void Bst<generic>::insert( generic x)
{
Bsn<generic> * temp = new Bsn<generic>;
if( m_root == NULL)
{
m_root -> data = x;
m_root -> r = NULL;
m_root -> l = NULL;
m_root -> p = NULL;
m_size++;
}
else
{
if( m_root -> r == NULL && x > m_root -> data)
{
}
else if( m_root -> r == NULL && x < m_root -> data)
{
}
else if( m_root -> r != NULL && x < m_root -> data)
{
}
else if( m_root -> r != NULL && x > m_root -> data)
{
}
else
{
if( m_root -> l == NULL && x < m_root -> data)
{
}
else if( m_root -> l != NULL && x < m_root -> data )
{
}
}
}
}
```

my Cppunit testing for the insert function

```
void Test_BST::test_insert()
{
Bst<int> r;
r.insert(1);
}
```

Thank you for your help

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting