I thought that I always need the std::
qualification for std::something
, unless I'm using std::something
or the whole namespace std
, but it seems that #include <vector>
makes, for instance, std::begin
availble as begin
.
Why is this the case?
#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?
}