Defining global constants in C++1z?

Viewed 4393

What is the best way of declaring memory efficient Global Constants in C++1z which do not make internal linkage, so a single copy is used though out all the translation units?

Although it's been mentioned in many places, we didn't have any singular "The best approach" question and answer, so here it is. Here is a partial list of places where I have found related questions.

I am looking for a solution for atleast all basic basic types, like int, double, char, std::string.

Edit 1: By best way, I mean "memory efficient". I know for internal linkage, multiple copies for each translation unit will be made, hence eating memory. Along with that if we can achieve fast execution time and compile time, that will be great, glamorizing (easiness of ) the code doesn't matter. Also I know external linkage will increase the fetching time because the processor may get cache misses at run time. But does latest C++ language support the best approach for all these ? Or may be suggested support for each case ?

Note: Also what will be best approach for std::string global constants ? Does there mutability will have any affect on there constness ?

3 Answers
Related