| | | | | |

Implementing Put

template <typename T, class P>
void BST<T,P>::Put (const T& t)
{
  Get(t) = t;
}
// Subtle!
// Get(t) returns reference to place for t in the tree
//  - either the existing one or one that it creates -
// and the assignment then places (the new copy of) t in the tree.
// If t was in the tree, this updates its value.
// If t was not in the tree, it is now with its current value
// (and the assignment is redundant)

| | Top of Page | 12. Binary Search Trees - 12 of 27