31 Jul
2014
31 Jul
'14
3:27 p.m.
On 7/31/14, 11:49am, Joaquin M Lopez Munoz wrote:
Ok, never mind, the problem is this: lookup functions take *keys*, not whole values, so instead of
auto q = p.equal_range(v);
you have to write
auto q = p.equal_range(MSB(v));
The bug goes undetected at compile time because there's a default conversion from __uint128_t to uint64_t, but this conversion of course does not extract the MSB part, hence the run-time problems. In more usual scenarios where the key is a member of the element, the error would have been more apparent and the code wouldn't have compiled.
Thanks Joaquin, you're very clear and helpful! Cheers!