Thursday, 15 August 2013

stl-like binary search tree in C

stl-like binary search tree in C

I need:
binary search tree C library like std::map
with lower_bound operation
with iterators stable across deletions
In C++ terms i need the following:
typedef std::map<K,V> map;
typedef map::iterator iter;
map m;
...
for (iter it = m.lower_bound(x); it != m.end(); )
{
if (is_bad(it->second))
m.erase(it++);
else
it++;
}
I can't use C++ though. I tried libavl, but it does not have lower_bound
operation and also traversing breaks after deletion AFAIU.

No comments:

Post a Comment