mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Removed dot-ctor for nullable
This commit is contained in:
parent
df50100353
commit
1fc6b31ffa
2 changed files with 411 additions and 398 deletions
|
@ -28,7 +28,7 @@ namespace System
|
|||
{
|
||||
if (!mHasValue)
|
||||
{
|
||||
Debug.FatalError("Nullable object must have a value.");
|
||||
Debug.FatalError("Value requested for null nullable.");
|
||||
}
|
||||
|
||||
return mValue;
|
||||
|
@ -42,7 +42,7 @@ namespace System
|
|||
{
|
||||
if (!mHasValue)
|
||||
{
|
||||
Debug.FatalError("Nullable object must have a value.");
|
||||
Debug.FatalError("Value requested for null nullable.");
|
||||
}
|
||||
|
||||
return ref mValue;
|
||||
|
@ -239,17 +239,17 @@ namespace System
|
|||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue + rhs);
|
||||
return Nullable<TResult>(lhs.mValue + rhs);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther + T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs + rhs.mValue);
|
||||
return Nullable<TResult>(lhs + rhs.mValue);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue + rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue + rhs.mValue);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -257,19 +257,19 @@ namespace System
|
|||
public static TResult? operator-<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther - T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs - rhs.mValue);
|
||||
return Nullable<TResult>(lhs - rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue - rhs);
|
||||
return Nullable<TResult>(lhs.mValue - rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue - rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue - rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -277,19 +277,19 @@ namespace System
|
|||
public static TResult? operator*<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther * T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs * rhs.mValue);
|
||||
return Nullable<TResult>(lhs * rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue * rhs);
|
||||
return Nullable<TResult>(lhs.mValue * rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue * rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue * rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -297,19 +297,19 @@ namespace System
|
|||
public static TResult? operator/<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther / T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs / rhs.mValue);
|
||||
return Nullable<TResult>(lhs / rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue / rhs);
|
||||
return Nullable<TResult>(lhs.mValue / rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue / rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue / rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -317,19 +317,19 @@ namespace System
|
|||
public static TResult? operator%<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther % T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs % rhs.mValue);
|
||||
return Nullable<TResult>(lhs % rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue % rhs);
|
||||
return Nullable<TResult>(lhs.mValue % rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue % rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue % rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -337,19 +337,19 @@ namespace System
|
|||
public static TResult? operator^<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ^ T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs ^ rhs.mValue);
|
||||
return Nullable<TResult>(lhs ^ rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue ^ rhs);
|
||||
return Nullable<TResult>(lhs.mValue ^ rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue ^ rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue ^ rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -357,19 +357,19 @@ namespace System
|
|||
public static TResult? operator&<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther & T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs & rhs.mValue);
|
||||
return Nullable<TResult>(lhs & rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue & rhs);
|
||||
return Nullable<TResult>(lhs.mValue & rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue & rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue & rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -377,19 +377,19 @@ namespace System
|
|||
public static TResult? operator|<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther | T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs | rhs.mValue);
|
||||
return Nullable<TResult>(lhs | rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue | rhs);
|
||||
return Nullable<TResult>(lhs.mValue | rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue | rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue | rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -402,19 +402,19 @@ namespace System
|
|||
public static TResult? operator??<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ?? T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs ?? rhs.mValue);
|
||||
return Nullable<TResult>(lhs ?? rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue ?? rhs);
|
||||
return Nullable<TResult>(lhs.mValue ?? rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue ?? rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue ?? rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -422,19 +422,19 @@ namespace System
|
|||
public static TResult? operator<< <TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther << T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs << rhs.mValue);
|
||||
return Nullable<TResult>(lhs << rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue << rhs);
|
||||
return Nullable<TResult>(lhs.mValue << rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue << rhs.mValue);
|
||||
return Nullable<TResult>(lhs.mValue << rhs.mValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ namespace System
|
|||
{
|
||||
struct Nullable<T> where T : struct
|
||||
{
|
||||
T mValue;
|
||||
T mValue;
|
||||
bool mHasValue;
|
||||
|
||||
public this(T value)
|
||||
|
||||
public this(T value)
|
||||
{
|
||||
mHasValue = true;
|
||||
mValue = value;
|
||||
|
@ -28,31 +28,39 @@ namespace System
|
|||
{
|
||||
if (!mHasValue)
|
||||
{
|
||||
Debug.FatalError("Nullable object must have a value.");
|
||||
Debug.FatalError("Value requested for null nullable.");
|
||||
}
|
||||
|
||||
return mValue;
|
||||
}
|
||||
}
|
||||
|
||||
public ref T ValueRef
|
||||
{
|
||||
public ref T ValueRef
|
||||
{
|
||||
[Inline]
|
||||
get mut
|
||||
{
|
||||
if (!mHasValue)
|
||||
{
|
||||
Debug.FatalError("Nullable object must have a value.");
|
||||
}
|
||||
|
||||
return ref mValue;
|
||||
}
|
||||
}
|
||||
get mut
|
||||
{
|
||||
if (!mHasValue)
|
||||
{
|
||||
Debug.FatalError("Value requested for null nullable.");
|
||||
}
|
||||
|
||||
return ref mValue;
|
||||
}
|
||||
}
|
||||
|
||||
public T GetValueOrDefault()
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public bool TryGetValue(ref T outValue)
|
||||
{
|
||||
if (!mHasValue)
|
||||
return false;
|
||||
outValue = mValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
public T GetValueOrDefault(T defaultmValue)
|
||||
{
|
||||
|
@ -67,371 +75,376 @@ namespace System
|
|||
str.Clear();
|
||||
}
|
||||
|
||||
[Inline]
|
||||
[Inline]
|
||||
public static implicit operator Nullable<T>(T value)
|
||||
{
|
||||
Nullable<T> result;
|
||||
Nullable<T> result;
|
||||
result.mHasValue = true;
|
||||
result.mValue = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
[Inline]
|
||||
public static explicit operator T(Nullable<T> value)
|
||||
{
|
||||
return value.mValue;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
public static bool operator==(Nullable<T> lhs, T rhs)
|
||||
[Inline]
|
||||
public static bool operator==(Nullable<T> lhs, T rhs)
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue == rhs;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator==<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T == TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue == rhs;
|
||||
}
|
||||
|
||||
public static bool operator==<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther == T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs == rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator==<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T == TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return !lhs.mHasValue && !rhs.mHasValue; // Only both being null results in 'true'
|
||||
return lhs.mValue == rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator!=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T != TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return true;
|
||||
return lhs.mValue != rhs;
|
||||
}
|
||||
|
||||
public static bool operator!=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther != T
|
||||
{
|
||||
if (!rhs.mHasValue) return true;
|
||||
return lhs != rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator!=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T != TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return !(!lhs.mHasValue && !rhs.mHasValue); // Only both being null results in 'false'
|
||||
return lhs.mValue != rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator< <TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T < TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue < rhs;
|
||||
}
|
||||
|
||||
public static bool operator< <TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther < T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs < rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator< <TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T < TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue < rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator<=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T <= TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue <= rhs;
|
||||
}
|
||||
|
||||
public static bool operator<=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther <= T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs <= rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator<=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T <= TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue <= rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator><TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T > TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue > rhs;
|
||||
}
|
||||
|
||||
public static bool operator><TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther > T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs > rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T > TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue > rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator>=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T >= TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue >= rhs;
|
||||
}
|
||||
|
||||
public static bool operator>=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther >= T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs >= rhs.mValue;
|
||||
}
|
||||
|
||||
public static bool operator>=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T >= TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue >= rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static int operator<=><TOther>(Nullable<T> lhs, TOther rhs) where int : operator T <=> TOther
|
||||
{
|
||||
return lhs.mValue <=> rhs;
|
||||
}
|
||||
|
||||
public static int operator<=><TOther>(TOther lhs, Nullable<T> rhs) where int : operator TOther <=> T
|
||||
{
|
||||
return lhs <=> rhs.mValue;
|
||||
}
|
||||
|
||||
public static int operator<=><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where int : operator T <=> TOther where TOther : struct
|
||||
{
|
||||
return lhs.mValue <=> rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue + rhs);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther + T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs + rhs.mValue);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue + rhs.mValue);
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther - T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs - rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue - rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue - rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther * T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs * rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue * rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue * rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther / T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs / rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue / rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue / rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther % T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs % rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue % rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue % rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ^ T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs ^ rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue ^ rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue ^ rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther & T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs & rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue & rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue & rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther | T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs | rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue | rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue | rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static T operator??(Nullable<T> lhs, T rhs)
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue == rhs;
|
||||
return (lhs.mHasValue) ? lhs.mValue : rhs;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator==<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T == TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue == rhs;
|
||||
}
|
||||
|
||||
public static bool operator==<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther == T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
public static bool operator==<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T == TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue == rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator!=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T != TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return true;
|
||||
return lhs.mValue != rhs;
|
||||
}
|
||||
|
||||
public static bool operator!=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther != T
|
||||
{
|
||||
if (!rhs.mHasValue) return true;
|
||||
return lhs != rhs;
|
||||
}
|
||||
|
||||
public static bool operator!=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T != TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue != rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator< <TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T < TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue < rhs;
|
||||
}
|
||||
|
||||
public static bool operator< <TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther < T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
public static bool operator< <TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T < TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue < rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator<=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T <= TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue <= rhs;
|
||||
}
|
||||
|
||||
public static bool operator<=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther <= T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs <= rhs;
|
||||
}
|
||||
|
||||
public static bool operator<=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T <= TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue <= rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator><TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T > TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue > rhs;
|
||||
}
|
||||
|
||||
public static bool operator><TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther > T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs > rhs;
|
||||
}
|
||||
|
||||
public static bool operator><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T > TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue > rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static bool operator>=<TOther>(Nullable<T> lhs, TOther rhs) where bool : operator T >= TOther
|
||||
{
|
||||
if (!lhs.mHasValue) return false;
|
||||
return lhs.mValue >= rhs;
|
||||
}
|
||||
|
||||
public static bool operator>=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther >= T
|
||||
{
|
||||
if (!rhs.mHasValue) return false;
|
||||
return lhs >= rhs;
|
||||
}
|
||||
|
||||
public static bool operator>=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T >= TOther where TOther : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return false;
|
||||
return lhs.mValue >= rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static int operator<=><TOther>(Nullable<T> lhs, TOther rhs) where int : operator T <=> TOther
|
||||
{
|
||||
return lhs.mValue <=> rhs;
|
||||
}
|
||||
|
||||
public static int operator<=><TOther>(TOther lhs, Nullable<T> rhs) where int : operator TOther <=> T
|
||||
{
|
||||
return lhs <=> rhs;
|
||||
}
|
||||
|
||||
public static int operator<=><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where int : operator T <=> TOther where TOther : struct
|
||||
{
|
||||
return lhs.mValue <=> rhs.mValue;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue + rhs);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther + T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs + rhs.mValue);
|
||||
}
|
||||
public static TResult? operator+<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T + TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue + rhs.mValue);
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther - T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs - rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue - rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator-<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T - TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue - rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther * T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs * rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue * rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator*<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T * TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue * rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther / T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs / rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue / rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator/<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T / TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue / rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther % T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs % rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue % rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator%<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T % TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue % rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ^ T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs ^ rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue ^ rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator^<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ^ TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue ^ rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther & T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs & rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue & rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator&<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T & TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue & rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther | T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs | rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue | rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator|<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T | TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue | rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ?? T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs ?? rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue ?? rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue ?? rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther << T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return .(lhs << rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return .(lhs.mValue << rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return .(lhs.mValue << rhs.mValue);
|
||||
}
|
||||
public static TResult? operator??<TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther ?? T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs ?? rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue ?? rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator??<TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T ?? TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue ?? rhs.mValue);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(TOther lhs, Nullable<T> rhs) where TResult = operator TOther << T where TResult : struct
|
||||
{
|
||||
if (!rhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs << rhs.mValue);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, TOther rhs) where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if (!lhs.mHasValue) return null;
|
||||
return Nullable<TResult>(lhs.mValue << rhs);
|
||||
}
|
||||
|
||||
public static TResult? operator<< <TOther, TResult>(Nullable<T> lhs, Nullable<TOther> rhs) where TOther : struct where TResult = operator T << TOther where TResult : struct
|
||||
{
|
||||
if ((!lhs.mHasValue) || (!rhs.mHasValue)) return null;
|
||||
return Nullable<TResult>(lhs.mValue << rhs.mValue);
|
||||
}
|
||||
}
|
||||
|
||||
extension Nullable<T> : IHashable where T : IHashable
|
||||
{
|
||||
public int GetHashCode()
|
||||
{
|
||||
if (!mHasValue)
|
||||
return 0;
|
||||
return mValue.GetHashCode();
|
||||
}
|
||||
}
|
||||
extension Nullable<T> : IHashable where T : IHashable
|
||||
{
|
||||
public int GetHashCode()
|
||||
{
|
||||
if (!mHasValue)
|
||||
return 0;
|
||||
return mValue.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue