add implementations of some more rblookup flags to the stl red black tree adapter

This commit is contained in:
Sears Russell 2010-09-23 20:38:50 +00:00
parent 4a5d14f2c6
commit 58c909a2ea
2 changed files with 10 additions and 3 deletions

View file

@ -65,7 +65,14 @@ const void * stl_rblookup(int m, const void * key, rbtree *tp) {
// printf("lookup incremented\n");
it++;
}
} else if(m == RB_LULTEQ) {
if(t->find(key) != t->end()) {
it --;
}
} else if(m == RB_LUNEXT) {
if(t->find(key) != t->end()) {
it++;
}
} else if(m == RB_LUGTEQ) {
// printf("greatequal\n");
// nothing to do.

View file

@ -34,10 +34,10 @@ void stl_rbdestroy(rbtree * tp);
//#define RB_NONE -1 /* None of those below */
//#define RB_LUEQUAL 0 /* Only exact match */
#define RB_LUGTEQ 1 /* Exact match or greater */
//#define RB_LULTEQ 2 /* Exact match or less */
#define RB_LULTEQ 2 /* Exact match or less */
//#define RB_LULESS 3 /* Less than key (not equal to) */
#define RB_LUGREAT 4 /* Greater than key (not equal to) */
//#define RB_LUNEXT 5 /* Next key after current */
#define RB_LUNEXT 5 /* Next key after current */
//#define RB_LUPREV 6 /* Prev key before current */
//#define RB_LUFIRST 7 /* First key in index */
//#define RB_LULAST 8 /* Last key in index */