Based on advice here (Why is "using namespace std" considered bad practice?), I'm avoiding using namespace std;
. However, based on what it says in Section 3.1 of C++ Primer, I have been making declarations individually, as in:
using std::cout;
using std::cin;
using std::setw;
using std::setprecision;
Assuming this is considered an acceptable practice, is there a compact way to state all of this on one line? I know I could do:
using std::cout; using std::cin; using std::setw; using std::setprecision;
but that is not particularly compact. I tried the following, in the spirit of how it works when defining variables:
using std::cout, std::cin, std::setw, std::setprecision;
But my compiler throws an exception.
If my assumption is wrong (i.e., if using std::cout;
is not good practice), then that may actually be the answer. I am certainly open to this, as I don't want to encourage or write smelly code..