System::Nullable::NullableBoolHelper 方法

Nullable::NullableBoolHelper method

帮助函数,用于检查 this 和 other 是否均非空,并在满足条件时调用 lambda。用于实现中。

template<typename T1> bool System::Nullable<T>::NullableBoolHelper(const T1 &other, const std::function<bool()> &f, bool default_if_both_are_null=false) const
参数描述
T1其他可空类型。
参数类型描述
其他const T1&用于比较的其他可空值。
fconst std::function<bool()>&如果 thisother 均非空时调用的 lambda。
default_if_both_are_nullbool如果两个值均为空时的返回值。

ReturnValue

如果 thisother 任一为空则返回 false;如果两者均为空则返回 default_if_both_are_null;如果两者均非空则返回 f 调用的结果。

另见