函数重载中的C ++默认参数评估一次还是每次?
|
我对对象中的重载函数的默认值有疑问。
如果我具有以下函数签名,则默认值将仅被评估一次还是每次?
class X
{
public:
f(const RWDate& d=RWDate::now());
}
// when calling f() do I get the current time each time?
X z;
z.f();
// is the default value of d recaculated in the function call?
z.f();
没有找到相关结果
已邀请:
1 个回复
氏脑
因此,每次调用函数并使用默认参数时都会评估默认参数。