His is saying to not use the using
directive in a header file. For example: Suppose that we had 2 files x.h and z.h with those declarations:
// x.h
namespace MyProject
{
using std::deque;
using std::ostream;
....
};
// z.h
namespace MyProject
{
using mystd::deque;
using mystd::ostream;
....
};
The question is: which ostream object will be called in your example?
// x.cpp
#include "x.h"
#include "z.h"
#include <ostream>
namespace MyProject
{
ostream& operator<<( ostream& o, const Y& y )
{
// ... uses Z in the implementation ...
return o;
}
int f( const deque<int>& d )
{
// ...
}
}
You would like to call x.h
definitions, but due the order of includes, it will call the z.h
includes definitions