[RFC] add push/pop pragma to control the scope of "using"

Jeffrey Walton noloader@gmail.com
Wed Jan 15 09:37:00 GMT 2020


On Wed, Jan 15, 2020 at 3:15 AM 马江 <majiang31312@gmail.com> wrote:
>
> Hello,
>   After  some google, I find there is no way to control the scope of
> "using" for the moment.  This seems strange as we definitely need this
> feature especially when writing inline member functions in c++
> headers.
>
>   Currently I am trying to build a simple class in a c++ header file
> as following:
>
> #include <string>
> using namespace std;
> class mytest
> {
>   string test_name;
>   int test_val;
> public:
>   inline string & get_name () {return test_name;}
> };

https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice



More information about the Gcc mailing list