什么是关于什么参数依赖查找的好解释?很多人也称它为Koenig Lookup.
我最好知道:
正如sort()其定义namespace std必须始终用作std::sort.但即使没有,下面的代码也能正确编译std.
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> nums = {4,3,1,7,2,0};
sort(nums.begin(),nums.end());
}
Run Code Online (Sandbox Code Playgroud)
但是这段代码没有.
#include <array>
#include <algorithm>
int main()
{
std::array<int,5> nums = {4,1,8,9,6};
sort(nums.begin(),nums.end());
}
Run Code Online (Sandbox Code Playgroud)
使用gcc 4.8.4with -std=c++11flag启用.
从这两个代码片段中可以清楚地知道std::vector这与此有关.但我无法弄明白.