Beispiel #1
0
        /// <summary>Copies the items in the array to a given destination.</summary>
        /// <param name="destination">The destination span where the items should be copied.</param>
        /// <exception cref="ArgumentOutOfRangeException"><see cref="Length" /> is greater than <paramref name="destination" />.</exception>
        public void CopyTo(UnmanagedSpan <T> destination)
        {
            var items  = _items;
            var length = _length;

            ThrowIfNotInInsertBounds(length, destination.Length, nameof(Length), nameof(destination));

            CopyArrayUnsafe <T>(destination.GetPointerUnsafe(0), items, length);
        }
Beispiel #2
0
        /// <summary>Copies the items in the array to a given destination.</summary>
        /// <param name="destination">The destination span where the items should be copied.</param>
        /// <exception cref="ArgumentOutOfRangeException"><see cref="Length" /> is greater than <paramref name="destination" />.</exception>
        public void CopyTo(UnmanagedSpan <T> destination)
        {
            AssertNotNull(this);

            var items  = &_data->Item;
            var length = _data->Length;

            ThrowIfNotInInsertBounds(length, destination.Length, nameof(Length), nameof(destination));

            CopyArrayUnsafe <T>(destination.GetPointerUnsafe(0), items, length);
        }
Beispiel #3
0
 /// <inheritdoc cref="UnmanagedSpan{T}.GetPointerUnsafe(nuint)" />
 public T *GetPointerUnsafe(nuint index) => _span.GetPointerUnsafe(index);