ekg / intervaltree

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

Not initializing `center` member variable in Constructor #16

Closed ghost closed 5 years ago

ghost commented 8 years ago

In the first branch, when intervals < bucket size, the center private variable is not initialized.

https://github.com/ekg/intervaltree/blob/8fc4be91866237995e1105689d84bece619f4663/IntervalTree.h#L90-L106

Added some prints in the code. As an example, when given 7 intervals:

IVALS SIZE: 7
IV: Interval(99291, 99295): 1
IV: Interval(99317, 99655): 1
IV: Interval(99317, 99548): 1
IV: Interval(99328, 99435): 1
IV: Interval(99351, 99380): 1
IV: Interval(99417, 99546): 1
IV: Interval(99483, 99673): 1

CENTER IS: 844424930131969

...

IVALS SIZE: 10
IV: Interval(97007, 97087): 1
IV: Interval(97008, 97164): 1
IV: Interval(97009, 97389): 1
IV: Interval(97020, 97180): 1
IV: Interval(97049, 97124): 1
IV: Interval(97115, 97305): 1
IV: Interval(97120, 97241): 1
IV: Interval(97209, 97226): 1
IV: Interval(97228, 97412): 1
IV: Interval(97298, 97332): 1

CENTER IS: 1