//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// UserRTX.NET satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;

#if !WASM
namespace user_rtx { using u = user_rtx;
#else
namespace user_rtx.wasm { using u = user_rtx.wasm;
#endif

/// <summary>
/// Not null object and value interpreter (strict accessor)
/// </summary>
public static class not_null {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="NullReferenceException" />
[u.strict_result]
public static T _<T>( T? instance )
where T: class =>
   instance ?? throw new NullReferenceException();

/// <exception cref="EZeroValue" />
[u.strict_result][u.returns_source]
public static IntPtr _( IntPtr ip ) =>
   ip != default ? ip : throw new EZeroValue();

/// <exception cref="ENullValue" />
[u.strict_result]
public static T V<T>( T? nullableValue )
where T: struct =>
   nullableValue ?? throw new ENullValue();

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // not_null

} // user_rtx (.wasm)
