[英]Is there a way to get a pair having both the lower_bound and upper_bound in a sorted array?
如果我有一個包含元素{1,1,1,2,2,2,3,3,3}
的std::vector
有沒有辦法讓一對包含 value = 2 的lower_bound
和upper_bound
?
而不是我分別調用std::lower_bound
和std::upper_bound
。
簡單地說,字面意思是: std::equal_range
您可以使用std::equal_range
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.