Skip to content

How to correctly check if set contains an element? #6

@asmorodinov

Description

@asmorodinov

Hello, from the benchmark code I figured out that this seems to be the way to check if set contains an element:

bool res = set.find(i + 1).leaf();

However, the following code seems to work incorrectly

for (int i = 0; i < 32; ++i) {
    set.insert(i);
    assert(!set.find(i + 1).leaf());
}

Here, assert fails at i = 31. This is very strange, since we never inserted i+1 into the set, so it should not be present in it.
Is this a bug?
Or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions