Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

PankajBhojwani
Copy link

@PankajBhojwani PankajBhojwani commented Oct 1, 2020

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

IntervalTree.h Outdated Show resolved Hide resolved
IntervalTree.h Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants