4 ms·
"Official", quote, alludes to very active curation by participants in the standardization process, with example code frequently updated to reflect changing best
by ncmncm 4y ago
"Official", quote, alludes to very active curation by participants in the standardization process, with example code frequently updated to reflect changing best practice.
Recognized best practice changes with both experience and with newly implemented language features. New features are proposed, and some standardized, specifically because they enable better ways of coding. So, best practice may change markedly with each new Standard.
Generally, the newest way to do something is usually best, for exactly that reason. (A common misconception has one sticking with older language features for better code. The reductio ad absurdum of this would prefer the C subset.) This does not oblige you to use every feature in every program; e.g., std::shared_ptr has sharply limited value. And, the absolutely newest features may not be very portable yet.
Sometimes more field experience with a feature and its interaction with others leads to changes to best practice. This should be expected particularly in use of concepts and asynchronous facilities.
As an example of change, the present universal preference for "std::" vs "using" took a long time to gel because writers (of articles, slides, textbooks) begrudged the extra space it took on their page.
Examples found on cppreference may usually be relied upon to produce sound results and to steer well clear of both risky usage and bad performance.