I'm trying to create a header of string constants for easy reference, and it currently looks like this:
#ifndef DRAWCONSTANTS_H #define DRAWCONSTANTS_H using namespace std; #include <string> // Standardized color strings. const string BLACK = "black"; const string WHITE = "white"; const string GRAY = "gray"; const string RED = "red"; const string PINK = "pink"; const string ORANGE = "orange"; const string YELLOW = "yellow"; const string LIGHT_GREEN = "light_green"; const string GREEN = "green"; const string LIGHT_BLUE = "light_blue"; const string BLUE = "blue"; const string PURPLE = "purple"; #endif /* DRAWINGCONSTANTS_H */
It works fine, no major problems here. But, I've heard a lot that using the declaration "using namespace std" is usually a bad thing. My question is, how much does that really matter, and if it does matter, is prefixing string declarations with "std::" absolutely the only way to make things work?
It seems like, in general, it's a matter of preference, but if there's a significant reason not to do things this way, please bring it to my attention.
EDIT: Just to be clear, I don't mean this as a general "how do you use the standard namespace" question, that I understand. My question is specifically, are there any special considerations for it that I might not know about when it's being used solely in a file of defined constants?
This post has been edited by Zel2008: 19 April 2012 - 08:05 AM