I am writing a binary search tree (currently finished, minus generic support), and am interested in making it a generic class (presumably using templates), that takes an object only if the object can sort itself by it's key. This will be done in my other object's class that I wrote (I will provide the key/comparison method).
How do I write the BST class such that it works for any object that implements a comparison interface? (That I can also write if needed). I have done this in Java, but would like to know the C++.
Java class declaraton: public class Myclass<O extends Comparable<K>>
where comparable is the interface used to specify that each object O must implement a method specified in the comparable interface that defines how an object O is compared to other O's.