Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-25 16:25:00 +01:00
1 親 65941ea4f8
コミット 5def7d1a00
3ファイル変更
+21 -3

検索条件に一致するファイルはありません

+18
ファイルの表示
@@ -9,6 +9,24 @@ namespace ComputeSharp.Core.Extensions
/// </summary>
public static class ComPtrExtensions
{
/// <summary>
/// Reinterprets the current <see cref="ComPtr{T}"/> instance as one of type <see cref="IUnknown"/>.
/// </summary>
/// <typeparam name="T">The type of the current <see cref="ComPtr{T}"/> instance.</typeparam>
/// <param name="ptr">The input <see cref="ComPtr{T}"/> instance to upcast.</param>
/// <returns>A <see cref="ComPtr{T}"/> instance of type <see cref="IUnknown"/>.</returns>
/// <remarks>
/// This method is meant to be used in a chained expression and it does not increment the reference
/// count for the input pointer. Do not expose the return value of this extension to consumers.
/// </remarks>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ref readonly ComPtr<IUnknown> AsIUnknown<T>(this in ComPtr<T> ptr)
where T : unmanaged
{
return ref Unsafe.As<ComPtr<T>, ComPtr<IUnknown>>(ref Unsafe.AsRef(in ptr));
}
/// <summary>
/// Gets the address of the current <see cref="ComPtr{T}"/> instance as a raw <see langword="void"/> double pointer.
/// </summary>