ekg / intervaltree

a minimal C++ interval tree implementation
MIT License
222 stars 66 forks source link

Allow user-defined structs as keys to the interval tree #31

Open PankajBhojwani opened 4 years ago

PankajBhojwani commented 4 years ago

Hello! Thank you for this implementation - it is extremely useful!

I'd like to propose a change that would allow custom structs to be used as keys to the tree as long as those structs have the <, <=, >, >=, == operators defined.

The only code change this involves is instead of checking for equality with 0, we check for equality with the default constructor. For integral values, this does not change the behaviour.

UPDATE: This also now adds a default constructor and the equality/inequality operators just for ease of use