Timeline for Are namespace constructs like 'using std::string' unacceptable also in .cpp files?
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 28, 2020 at 20:36 | comment | added | Christian Hackl |
By the way, another important aspect is that C++11's auto made many previous uses of using to abbreviate type names obsolete, such as when something like std::map<std::string, std::vector<std::string>>::const_iterator iter can be reduced to auto iter.
|
|
| Feb 28, 2020 at 20:28 | comment | added | Christian Hackl |
@jk.: For source files? I doubt it. For header files, maybe. If you are doing application development, then you have full control over where and how your header files are included, so the arguments against using namespace at global scope become slightly less relevant, although I think it's still a very bad idea.
|
|
| Feb 28, 2020 at 13:17 | comment | added | Deduplicator |
There is weak consensus that using namespace should only be used with closed or owned namespaces even in implementation files.
|
|
| Feb 28, 2020 at 12:03 | comment | added | jk. | iirc there is also a bit of a difference depending on if you are doing application development of library development. | |
| Feb 28, 2020 at 10:33 | history | answered | Martin Ba | CC BY-SA 4.0 |