Mam ten problem że muszę zrobić funkcję clear() ale nie za bardzo mam pomysł jak to zrobić aby dwukrotnie nie usuwać tych samych elementów bo widzę że sam destruktor wszystko usuwa..

using namespace std;
class BSTree
{
	int value;
	BSTree*left;
	BSTree*right;

public:
	BSTree();
	BSTree(int value);
	bool isEmpty() const;
	~BSTree();
	void insert(int);
	friend std::ostream& operator<<(std::ostream& stream, BSTree* bst);
	void printInOrder() const;
	bool contains(int wartosc) const;
	void clear();
	int getVal();
};

BSTree::~BSTree()
{
	cout <<endl<<this->getVal()<< "wywolanie destruktora" << endl;
	delete left;
	delete right;
}

void BSTree::clear()
{
	
	if (left != nullptr) {
		if ((left->left) == nullptr && (left->right) == nullptr)
			delete left;
		else
			left->clear();
		
	}
	if (right != nullptr) {
		if ((right->left) == nullptr && (right->right) == nullptr)
			delete right;
		else
			right->clear();
		
	}

}
int BSTree::getVal()
{

	return value;
}

int main(){
BSTree bst;
		cout << (bst.isEmpty() ? "Drzewo jest puste" : "Drzewo nie jest puste") << endl;
		bst.insert(5);
		bst.insert(3);
		bst.insert(7);
		bst.insert(4);
		bst.insert(2);
		cout << (bst.isEmpty() ? "Drzewo jest puste" : "Drzewo nie jest puste") << endl;
		cout << "Drzewo zawiera element o wartosci 3: " << bst.contains(3) << endl;
		
		bst.printInOrder();

		bst.clear();
		
	}

Nie wrzucam wszystkich funkcji żeby łatwiej było ogarnąć.