Catch lower_bound from a Multiset in Indice 0 mode

Asked

Viewed 17 times

0

Here comes the code:

first = mult.lower_bound(c);
        last = mult.upper_bound(c);
        if (first == mult.end())
        {
            printf("%d not found\n", c);
        }
        else
        {
            printf("%d found from %d to %d\n", c, first, last);
        }

The problem is that first and last are iterators, I’ve tried first - mult.Begin() but the IDE does not accept :/

1 answer

0

Solved, I used a distance(mult.begin(), first) and pro last too :D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.