C++ STL:将空容器传递给lower_bound

Fel*_*End 6 c++ containers stl stl-algorithm

传递空容器的行为是否已std::lower_bound定义?

我检查了cppreference.com和我在网上找到的旧版C++标准,但找不到明确的答案.

用于cppreference.com文档std::deque::erase了一句

在以下情况下,迭代器首先不需要可解除引用first==last:删除空范围是无操作.

我想念这样的东西std::lower_bound以及其他算法.

Fur*_*ish 8

关于返回值的Cppreferencestd::lower_bound(first, last):

"[它返回] Iterator指向第一个不小于value的元素,或者last没有找到这样的元素. "

(强调我的)

在空范围内,将没有符合条件的元素,因此last将返回.

由此得出结论,std::lower_bound在空范围上应用(和类似)是明确定义的.它没有做任何事情和回报last,这等于first.