Replace()

System::MemoryExtensions::Replace(Span<T>&, const T&, const T&) function

Replaces all occurrences of a value with a new value in a Span.

template<typename T> void System::MemoryExtensions::Replace(Span<T> &span, const T &oldValue, const T &newValue)

Template parameters

ParameterDescription
TThe type of elements in the span

Arguments

ParameterTypeDescription
spanSpan<T>&The span to modify in-place
oldValueconst T&The value to search for and replace
newValueconst T&The new value to replace oldValue with

System::MemoryExtensions::Replace(const ReadOnlySpan<T>&, Span<T>&, const T&, const T&) function

Copies elements from source to destination, replacing specified values during copy.

template<typename T> void System::MemoryExtensions::Replace(const ReadOnlySpan<T> &source, Span<T> &destination, const T &oldValue, const T &newValue)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
sourceconst ReadOnlySpan<T>&The source ReadOnlySpan to copy from
destinationSpan<T>&The destination Span to copy to
oldValueconst T&The value to search for and replace during copying
newValueconst T&The new value to replace oldValue with

See Also