static retcode_t hash_goFirst(Iterator_t It) { hashIter_t hi = (hashIter_t)__getIterCtx(It); if(hi == NULL) return TB_ERR; _findFirst(hi->H, &(hi->first), &(hi->first_ndx)); hi->cur_node = hi->first; hi->cur_ndx = hi->first_ndx; if(hi->hasDupes) hi->dup_ndx = 0; return TB_OK; }
static hashIter_t hash_newIterCtx(Hash_t H) { if( tb_getSize(H) >0) { hashIter_t hi = (hashIter_t)tb_xcalloc(1, sizeof(struct hashIter)); hi->H = H; _findFirst(H, &(hi->first), &(hi->first_ndx)); _findLast(H, &(hi->last), &(hi->last_ndx)); hi->cur_node = hi->first; hi->cur_ndx = hi->first_ndx; hi->hasDupes = XHASH(H)->allow_duplicates; hi->dup_ndx = 0; return hi; } return NULL; }
vector<DirEntry>::iterator DirEntryList::_findUpperBound(const Key &key) { return _findFirst(key, [&key] (const DirEntry &entry) { return std::less<Key>()(key, entry.key); }); }