Le 25/06/2016 20:56, Georg Baum a écrit :
I recently stumbled upon

using std::shared_ptr;

or

lyx::support::FileName;

in header files (e.g. TocBackend.h). The shared_ptr was introduced as part
of the lyx::shared_ptr removal (which did either point to boost or std), but
there are other hits as well. While I understand that in this particular
case the "using" statement avoided other changes in the headers, I consider
it dangerous to have "using" statements in header files in general:

using foo::bar

effectively forbids to use the name 'bar' in any other namespace in the
whole program, since simply adding or removing an #include of the
corresponding header subtly changes the name lookup. Therefore I'd like to
remove these using statements. OK?


Agreed. While the only advices to avoid "using" in headers I could find
are about "using namespace", I do not see a reason either not to have as
a rule what you wrote.


Reply via email to