Closed pcaparser closed 7 years ago
I wrote the following code, kh_put -> kh_del -> kh_put
KHASH_MAP_INIT_INT(1, int) KHASH_MAP_INIT_INT(2, int) int main() { int ret; khiter_t k; khiter_t j; khash_t(1) h = kh_init(1); khash_t(2) i = kh_init(2);
int x = 0, y = 0; for (; x < 100; x++) { k = kh_put(1, h, x, &ret); kh_value(h, k) = x; j = kh_put(2, i, x, &ret); kh_value(i, j) = x + 1; } printf("h size:%d, i size: %d\n", kh_size(h), kh_size(i)); for (x = kh_begin(h); x < kh_end(h); x++) { kh_del(1, h, x); } for (x = kh_begin(i); x < kh_end(i); x++) { kh_del(2, i, x); } printf("h size:%d, i size: %d\n", kh_size(h), kh_size(i)); for (; x < 100; x++) { k = kh_put(1, h, x, &ret); kh_value(h, k) = x; j = kh_put(2, i, x, &ret); kh_value(i, j) = x + 1; } printf("h size:%d, i size: %d\n", kh_size(h), kh_size(i)); return 0;
}
expect the result should be h size:100, i size: 100 h size:0, i size: 0 h size:100, i size: 100
but got: h size:100, i size: 100 h size:0, i size: 0 h size:0, i size: 0
can anyone tell me what's the problem? thanks.
Is there javascript analog new Set or new Map?
I wrote the following code, kh_put -> kh_del -> kh_put
KHASH_MAP_INIT_INT(1, int) KHASH_MAP_INIT_INT(2, int) int main() { int ret; khiter_t k; khiter_t j; khash_t(1) h = kh_init(1); khash_t(2) i = kh_init(2);
}
expect the result should be h size:100, i size: 100 h size:0, i size: 0 h size:100, i size: 100
but got: h size:100, i size: 100 h size:0, i size: 0 h size:0, i size: 0
can anyone tell me what's the problem? thanks.