#include <utility>
struct A
{
A(int x, int y)
{
using std::swap; // OK
swap(x, y);
}
};
struct B
{
//
// The line below is illegal:
//
using std::swap;
//
// error : using declaration in class
// refers into 'std::', which is not a class
//
B(int x, int y)
{
swap(x, y);
}
};
The question is embedded in the example above.
I just wonder:
Why does the C++ standard prohibit such a usage?
What's the rationale behind?