What's the scope of the “using” declaration in C++?

后端 未结 7 633
醉话见心
醉话见心 2020-12-07 19:45

I\'m using the \'using\' declaration in C++ to add std::string and std::vector to the local namespace (to save typing unnecessary \'std::\'s).

using std::str         


        
相关标签:
7条回答
  • In the case cited, the file ("translation unit"), which means yes, every file that includes it.

    You can also put the using statement inside the class, in which case, it's in effect just for that class.

    Generally, if you need to specify a namespace in a header, it's often best to just fully-qualify every identifier necessary.

    0 讨论(0)
提交回复
热议问题