a minimal C++ interval tree implementation