DIP 1007 Preliminary Review Round 1

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 25 01:22:23 PDT 2017


On Monday, 24 April 2017 at 22:22:14 UTC, Atila Neves wrote:
> In headers. Not in source files, and I don't know why anyone 
> would want to keep typing `std::` all the time.

C++ is increasingly becoming dependent on templates so header 
files are expanding at the cost of ".cpp source files". If more 
than half the code base is in header files then it makes little 
sense to not use "std::" fully qualified, both for clarity, 
name-resolution and usability reasons (cut and paste).

(For templates the core guidelines says that one should use 
"std::" and only use unqualified names for situations where you 
want to override the "std::" provided definition with a local 
implementation if it exists.)

> Never mind the monstrosity that would be trying to use the C++ 
> user-defined literal without `using namespace std`:
>
> #include <string>
> using namespace std::operator""s;  // Argh! My eyes!

You could just wrap that up in an application level string header.



More information about the Digitalmars-d mailing list