Code Fragment: BST1



template <typename Key, typename Element,
			typename BSTItem = Item<Key, Element> >
class BinarySearchTree {
protected: 						// local types
  typedef BinaryTree<BSTItem>::Position	BTPosition;	// a tree position
public: 						// public types
  // ... (insert Position here)
protected: 						// member data
  BinaryTree<BSTItem> T;				// the binary tree
protected: 						// local utilities
  Key key(const BTPosition& p) const 			// get position's key
    { return p.element().key(); }
  							// set a node's item
  void setItem(const BTPosition& p, const BSTItem& i) const {
    p.element().setKey(i.key());
    p.element().setElement(i.element());
  }
public:
  BinarySearchTree() : T() { }				// constructor
  int size() const 					// size
    { return (T.size() - 1) / 2; }			// number of internals
  bool isEmpty() const
    { return size() == 0; }
  // ... (insert find, insert, and remove functions here)
};