Add assertion to make sure new registered range is not overlapping with existing ones

This commit is contained in:
chaoguang 2020-04-08 14:27:05 -07:00
parent 4a9658d6b8
commit 535efa0c4c
1 changed files with 3 additions and 0 deletions

View File

@ -46,6 +46,9 @@ public:
// range check
// TODO: add range check not to be replaced by overlapped ones
ASSERT(kr.begin >= range.begin && kr.end <= range.end);
// make sure the registered range is not overlapping with existing ones
// Note: kr.end should not be the same as another range's begin, although it should work even they are the same
ASSERT(impls.rangeContaining(kr.begin) == impls.rangeContaining(kr.end) && impls[kr.begin] == nullptr);
impls.insert(kr, impl);
}