如 lower_bound 定义在库 algorithm 中,但为什么可以不调用 algorithm 库而直接调用该函数?
lower_bound
algorithm
#include<cstdio> #include<iostream> int main(){ int a[]={0,1,4,5,6,7}; int *pi=std::lower_bound(a,a+6,3); //正确 std::cout<<*pi; std::sort(a,a+6); //错误:未调用 algorithm 库 return 0; }