Nullable

Nullable class

Forward declaration.

template<typename T>class Nullable

Template parameters

ParameterDescription
TThe underlying value type which is extended by the Nullable class

Methods

MethodDescription
std::enable_if<IsNullable<T1>::value, bool>::type Equals(const T1&) constDetermines if the value represented by the current object is equal to the value represented by the specified Nullable object.
bool get_HasValue() constDetermines whether the current object represents any value.
T get_Value() constReturns a copy of the value represented by the current object.
int GetHashCode() constReturns a hash code for the current object.
T GetValueOrDefault(T)Returns the value represented by the current object or the specified value if the value represented by the current object is null.
T GetValueOrDefault()
bool IsNull() constDetermines if the current object represents a null-value.
Nullable()Constructs an instance that represents null-value.
Nullable(std::nullptr_t)Constructs an instance that represents null.
Nullable(const T1&)Constructs an instance of Nullable class that represents the specified value converted (if necessary) to the value of the underlying type T.
Nullable(const Nullable<T1>&)Constructs an instance that represents a value that is represented by the specified Nullable object. The specified nullable object may represent a value of different type than the underlying type of the constructed instance in which case the represented value is converted to a value of type T.
bool NullableBoolHelper(const T1&, const std::function<bool()>&, bool) constHelper function to check if this and other are both not nulls and call a lambda if so. Used in implementation.s.
operator const T &() constReturns a constant reference to the value represented by the current object.
bool operator!=(std::nullptr_t) constDetermines if the value represented by the current object is not null.
std::enable_if<!IsNullable<T1>::value, bool>::type operator!=(const T1&) constDetermines if the value represented by the current object is not equal to the specified value.
bool operator!=(const Nullable<T1>&) constDetermines if the value represented by the current object is not equal to the value represented by the specified Nullable object.
std::enable_if<std::is_same<T1, bool>::value, Nullable<T>>::type operator&=(bool)Applies operator&=() to the value represented by the current object using the specified value as a right-side argument.
Nullable<T> operator+(std::nullptr_t) constReturns a default constructed instance of Nullable class.
auto operator+(const T1&) constSums nullable and non-nullable values.
auto operator+(const Nullable<T1>&) constSums nullable values.
Nullable<T> operator+=(std::nullptr_t)Resets the current object so that it represents a null-value.
std::enable_if<!IsNullable<T1>::value, Nullable<T>>::type operator+=(const T1&)Applies operator+=() to the value represented by the current object using the specified value as a right-side argument.
Nullable<T> operator+=(const Nullable<T1>&)Applies operator+=() to the value represented by the current object using the value represented by the specified Nullable object as the right-side argument.
Nullable<T> operator-(T1) constSubtracts nullable and null-pointed values.
auto operator-(const T1&) constSubtracts nullable and non-nullable values.
auto operator-(const Nullable<T1>&) constSubtracts nullable values.
Nullable<T> operator-=(T1)Returns an instance of Nullable class that represents a null-value.
std::enable_if<!IsNullable<T1>::value, Nullable<T>>::type operator-=(const T1&)Applies operator-=() to the value represented by the current object using the specified value as a right-side argument.
Nullable<T> operator-=(const Nullable<T1>&)Applies operator-=() to the value represented by the current object using the value represented by the specified Nullable object as the right-side argument.
bool operator<(std::nullptr_t) constAlways returns false.
std::enable_if<!IsNullable<T1>::value, bool>::type operator<(const T1&) constDetermines if the value represented by the current object is less than the specified value by applying operator<() to these values.
bool operator<(const Nullable<T1>&) constDetermines if the value represented by the current object is less than the value represented by the specified Nullable object by applying operator<() to these values.
bool operator<=(std::nullptr_t) constAlways returns false.
std::enable_if<!IsNullable<T1>::value, bool>::type operator<=(const T1&) constDetermines if the value represented by the current object is less or equal to the specified value by applying operator<=() to these values.
bool operator<=(const Nullable<T1>&) constDetermines if the value represented by the current object is less or equal to the value represented by the specified Nullable object by applying operator<=() to these values.
Nullable<T> operator=(std::nullptr_t)Assigns a null to the current object.
std::enable_if<!IsNullable<T1>::value&&!std::is_null_pointer<T1>::value, Nullable<T>&>::type operator=(const T1&)Replaces the object’s currently represented value with the specified one.
Nullable<T>& operator=(const Nullable<T1>&)Replaces the object’s currently represented value with the specified one.
bool operator==(std::nullptr_t) constDetermines if the value represented by the current object is null.
std::enable_if<!IsNullable<T1>::value, bool>::type operator==(const T1&) constDetermines if the value represented by the current object is equal to the specified value.
bool operator==(const Nullable<T1>&) constDetermines if the value represented by the current object is equal to the value represented by the specified Nullable object.
bool operator>(std::nullptr_t) constAlways returns false.
std::enable_if<!IsNullable<T1>::value, bool>::type operator>(const T1&) constDetermines if the value represented by the current object is greater than the specified value by applying operator>() to these values.
bool operator>(const Nullable<T1>&) constDetermines if the value represented by the current object is greater than the value represented by the specified Nullable object by applying operator>() to these values.
bool operator>=(std::nullptr_t) constAlways returns false.
std::enable_if<!IsNullable<T1>::value, bool>::type operator>=(const T1&) constDetermines if the value represented by the current object is greater or equal to the value represented by the specified object by applying operator>=() to these values.
bool operator>=(const Nullable<T1>&) constDetermines if the value represented by the current object is greater or equal to the value represented by the specified Nullable object by applying operator>=() to these values.
std::enable_if<std::is_same<T1, bool>::value, Nullable<T>>::type [operator=](./operator_or_equal/)(bool)
void reset()Sets the currently represented value to null.
String ToString() constConverts the value represented by the current object to string.

Typedefs

TypedefDescription
ValueTypeAn alias for a type of the value represented by this class.

Remarks

Represents a value of the specified type that can be assigned null. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

See Also