参数传递中 const 位置的 C++ 标准是什么?

What's the c++ standard in const postion in parameter passing?

如果我没记错的话,这些函数参数:

void foo(const Type& type);
void foo(Type const& type);

是等价的。声明它们的标准方法是什么? 通过使用第一个或第二个函数声明? 如果 ISO C++ 没有定义任何规范,我的意思是 "standard" 最易读和最常用的版本。

What is the standard way to declare them?

两者都是标准的。

With "standard" I mean the most readable and used version

可读性在于旁观者的眼睛。我更喜欢第二种,因为它给出了一致的从右到左的顺序。有些人更喜欢第一个,因为它明确地将限定符与其限定的类型相关联。

没有普遍接受的 C++ 风格指南。我能想到的最接近的是 Google's C++ guide 而他们在这个问题上要说的是...

Some people favor the form int const foo to const int foo. They argue that this is more readable because it's more consistent: it keeps the rule that const always follows the object it's describing. However, this consistency argument doesn't apply in codebases with few deeply-nested pointer expressions since most const expressions have only one const, and it applies to the underlying value. In such cases, there's no consistency to maintain. Putting the const first is arguably more readable, since it follows English in putting the "adjective" (const) before the "noun" (int).

That said, while we encourage putting const first, we do not require it. But be consistent with the code around you!