我认为我总是需要 的std::
资格std::something
,除非我是using std::something
或整体namespace std
,但似乎这#include <vector>
使得,例如,std::begin
可用begin
。
为什么会这样?
#include <vector>
int main(){
int w[3];
begin(w); // Ok, this doesn't compile, as I'm not `using std::begin` nor `using namespace std`.
std::vector<int> v;
v.begin(); // Ok, as this is the member function.
begin(v); // Why does this compile? What is making this free-function available unqualifiedly?
}