我有一个简单的对象,包含一些[公共]数据.
我想保持我的界面干净,所以我不想预先/后修复任何公共可访问变量的名称,也不希望我的函数参数的名称.
那就是说,我最终做了这样的事情:
template<typename T> struct Foo
{
explicit Foo(T x) : x(x) // This [i.e., x(x)] seems to be doing the "Right Thing", but is this well defined?
{/* ^
No pre-/post- fixing.
*/
}
T x; // No pre-/post- fixing.
};
Run Code Online (Sandbox Code Playgroud)
只是重申一下:我所要问的是这是否是明确定义的行为.不是我应该或不应该这样做......
谢谢.