can i use equal_range to get range of values or end of container?

122 views Asked by At

i know that equal_range(k) gets me range of values:
starting with k or element greater than k or end and
finishing with element greater than k or end.
i wanna modify this behaviour to give me only range of values :
starting with k or end
finishing with element greate than k or end

this is to reach result that if the range is not present in container then return iterators to end so that i could compare them to end of container.
how can i do this???
i tried to use range function ?
but when i pass make_tuple forming composite key to lower_bound it gives me huge errors so that i give up

1

There are 1 answers

0
ahmed allam On BEST ANSWER

i found that if i use the comparison between the two iterators resulting from equal_range then they are equal if the value used for equal_range is not present in container so the lower_bound of value is the value greater than it and the upper_bound is also the value greater than it so value is not present.
and if the value is present then the 2 iterators are not equal .
and i should not use end iterator.