NL.18:使用C ++风格的声明符布局
The C-style layout emphasizes use in expressions and grammar, whereas the C++-style emphasizes types. The use in expressions argument doesn't hold for references.
C风格布局强调变量在表达式中使用时的状态和语法,而C ++风格强调类型。表达式中使用时的参数不适用于引用。
Example(示例)
T& operator[](size_t); // OK
T &operator[](size_t); // just strange
T & operator[](size_t); // undecided
This is a recommendation for when you have no constraints or better ideas. This rule was added after many requests for guidance.
当您没有约束或更好的做法时,考虑这个建议。此规则可以作为许多准则之外的附加要求。
Enforcement(实施建议)
Impossible in the face of history.
面对历史时不可能。
原文链接
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl18-use-c-style-declarator-layout