There's recommendation in C++ community to not to use using namespace std;
. But suppose you want to use string literals e.g. auto s = "dummy's;
.
Not using using namespace std;
cause to failed compile. What is the solution?
So, to only get the string literals, use Alternatevely, if you want to include every literal - including the string literals (like Depending on the situation, you might also consider using:
instead of importing every name from that namespace. Note that you should still not include it in a header, at global level (but you can do it inside inline or member functions or namespaces you control) |
|||||||||||||||||||||
|
For string literals you can use:
That will pull about
Then you pull in thousands of names, many of which are commonly used in programs like That's not an issue with the string literals. Also none of the names that However you should still avoid |
|||||
|
Above operators are declared in the |
|||
|
operator""s
shows exactly what you want – underscore_d 3 hours ago