[英]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.