草庐IT

sortedValues

全部标签

c++ - 获取位于特定区间内的已排序值列表的子列表的最短方法

今天我在问自己,获取排序vector中所有值的最短代码可能是什么std::vector,大于或等于a小于或等于b.我的第一种方法类似于以下内容:#include#include#include#include//ReturnsallvaluesinsortedValuesbeinggreaterequalstartandsmallerequalend;std::vectorcutValues(conststd::vector&sortedValues,doublestart,doubleend){std::vectorret;autostartIter=std::lower_bound