I write code and mess with computers.

  • 2 Posts
  • 2 Comments
Joined 4 years ago
cake
Cake day: May 11th, 2021

help-circle


  • Most things in the various STD libs are namespaced as to not clash with other programs. using namespace imports everything in a namespace into your current namespace, even for things you didn’t include.

    It’s just a shortcut to write less, and is a bad habit taught to beginners. It can cause name collisions for all sorts of things since it imports all of std, not just the headers you include.

    Just don’t use it. If you insist, scope your use of using by putting it inside of functions/methods, and specify specific things to import (i.e. using std::string;).