System::Nullable class

Nullable class

前向声明。

template<typename T>class Nullable
参数描述
TNullable 类扩展的底层值类型

方法

方法描述
Equals(const T1&) const确定当前对象表示的值是否等于指定的 Nullable 对象表示的值。
get_HasValue() const确定当前对象是否表示任何值。
get_Value() const返回当前对象表示的值的副本。
GetHashCode() const返回当前对象的哈希码。
GetValueOrDefault(T)返回当前对象表示的值;如果当前对象表示的值为 null,则返回指定的值。
GetValueOrDefault()
IsNull() const确定当前对象是否表示 null 值。
Nullable()构造表示 null 值的实例。
Nullable(std::nullptr_t)构造表示 null 的实例。
Nullable(const T1&)构造一个 Nullable 类的实例,该实例表示指定的值(如有必要会转换为底层类型 T 的值)。
Nullable(const Nullable<T1>&)构造一个实例,该实例表示由指定的 Nullable 对象所表示的值。指定的可空对象可能表示的值类型与构造实例的底层类型不同,在这种情况下,表示的值将转换为类型 T 的值。
NullableBoolHelper(const T1&, const std::function<bool()>&, bool) const帮助函数,用于检查 this 和 other 是否均非空,并在满足条件时调用 lambda。用于实现中。
operator const T &() const返回当前对象所表示值的常量引用。
operator!=(std::nullptr_t) const确定当前对象所表示的值是否为非空。
operator!=(const T1&) const确定当前对象所表示的值是否不等于指定的值。
operator!=(const Nullable<T1>&) const确定当前对象所表示的值是否不等于由指定的 Nullable 对象所表示的值。
operator&=(bool)对当前对象所表示的值应用 operator&=(),使用指定的值作为右侧参数。
operator+(std::nullptr_t) const返回 Nullable 类的默认构造实例。
operator+(const T1&) const对可空值和非可空值进行求和。
operator+(const Nullable<T1>&) const对可空值进行求和。
operator+=(std::nullptr_t)重置当前对象,使其表示一个空值。
operator+=(const T1&)对当前对象所表示的值应用 operator+=(),使用指定的值作为右侧参数。
operator+=(const Nullable<T1>&)对当前对象所表示的值应用 operator+=(),使用指定的 Nullable 对象所表示的值作为右侧参数。
operator-(T1) const对可空值和空值进行相减。
operator-(const T1&) const对可空值和非可空值进行相减。
operator-(const Nullable<T1>&) const对可空值进行相减。
operator-=(T1)返回表示空值的 Nullable 类实例。
operator-=(const T1&)对当前对象所表示的值应用 operator-=(),使用指定的值作为右侧参数。
operator-=(const Nullable<T1>&)对当前对象所表示的值应用 operator-=(),使用指定的 Nullable 对象所表示的值作为右侧参数。
operator<(std::nullptr_t) const始终返回 false。
operator<(const T1&) const通过对这些值应用 operator<() 来确定当前对象所表示的值是否小于指定的值。
operator<(const Nullable<T1>&) const通过对这些值应用 operator<() 来确定当前对象所表示的值是否小于指定的 Nullable 对象所表示的值。
operator<=(std::nullptr_t) const始终返回 false。
operator<=(const T1&) const通过对这些值应用 operator<=() 来确定当前对象所表示的值是否小于或等于指定的值。
operator<=(const Nullable<T1>&) const通过对这些值应用 operator<=() 来确定当前对象所表示的值是否小于或等于指定的 Nullable 对象所表示的值。
operator=(std::nullptr_t)将空值赋给当前对象。
operator=(const T1&)用指定的值替换对象当前表示的值。
operator=(const Nullable<T1>&)用指定的值替换对象当前表示的值。
operator==(std::nullptr_t) const确定当前对象表示的值是否为 null。
operator==(const T1&) const确定当前对象表示的值是否等于指定的值。
operator==(const Nullable<T1>&) const确定当前对象表示的值是否等于指定的 Nullable 对象表示的值。
operator>(std::nullptr_t) const始终返回 false。
operator>(const T1&) const通过对这些值应用 operator>() 来确定当前对象表示的值是否大于指定的值。
operator>(const Nullable<T1>&) const通过对这些值应用 operator>() 来确定当前对象表示的值是否大于指定的 Nullable 对象表示的值。
operator>=(std::nullptr_t) const始终返回 false。
operator>=(const T1&) const通过对这些值应用 operator>=() 来确定当前对象表示的值是否大于或等于指定对象表示的值。
operator>=(const Nullable<T1>&) const通过对这些值应用 operator>=() 来确定当前对象表示的值是否大于或等于指定的 Nullable 对象表示的值。
[operator=](./operator_=/)(bool)
reset()将当前表示的值设为 null。
set_Value(const T&)为可空对象设置新值。
ToString() const将当前对象表示的值转换为字符串。

Typedefs

类型定义描述
ValueType此类表示的值类型的别名。

备注

表示一种可以赋值为 null 的指定类型的值。此类型应在栈上分配,并通过值或引用传递给函数。切勿使用 System::SmartPtr 类来管理此类型的对象。

另见