I recently saw this code being used in a source file in a C++ project:
using namespace std;
#include
Ignoring all issues o
This code is undefined behavior [lib.using.headers]:
A translation unit shall include a header only outside of any external declaration or definition, and shall include the header lexically before the first reference to any of the entities it declares or first defines in that translation unit.
You reference std and then include a header that declares it. Even this is still undefined behavior:
#include
using namespace std;
#include