Menu

#657 Patch for removing `using namespace std;` from headers

Next_major_release
open
nobody
namespace (1)
7
2015-03-15
2015-03-13
No

While investigating compilation-time-improvements, I noticed a bunch of using namespace std; in header files.

This is a big no-no, so I fixed it. This patch qualifies all uses of std:: functions/variables in headers, and most uses in .cpp files. In .cpp files where there are too many uses of std:: functions/variables, I've inserted a using std::vector; or using std::string; immediately after all the includes.

1 Attachments

Discussion

  • Menno Vogels

    Menno Vogels - 2015-03-13

    Could you elaborate on why it is a big no-no?

     
  • Alexander Riccio

    A multitude of reasons. It's also almost always unnecessary, if just a few types/functions are needed, as for that, we can using std::vector.

     

    Last edit: Alexander Riccio 2015-03-14
  • Menno Vogels

    Menno Vogels - 2015-03-14

    Thanx

     
  • Alexander Riccio

    Yeah, you can get away with it small projects/CS courses, but it's a ticking time bomb anywhere else.

     
  • Don HO

    Don HO - 2015-03-15

    Alexander,

    Could you make a souce zip for the merge?

    Thank you,
    Don