Count()

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

Counts occurrences of a value in a read-only span.

template<typename T> int32_t System::MemoryExtensions::Count(const ReadOnlySpan<T> &span, const T &value)

Template parameters

ParameterDescription
TThe type of elements in the span

Arguments

ParameterTypeDescription
spanconst ReadOnlySpan<T>&The span to search in
valueconst T&The value to count

Return Value

The number of times value appears in span

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

Counts occurrences of a span within another read-only span.

template<typename T> int32_t System::MemoryExtensions::Count(const ReadOnlySpan<T> &span, const ReadOnlySpan<T> &value)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
spanconst ReadOnlySpan<T>&The span to search in
valueconst ReadOnlySpan<T>&The span to count occurrences of

Return Value

The number of times value appears in span

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

Counts occurrences of a single value in a Span

template<typename T> int32_t System::MemoryExtensions::Count(const Span<T> &span, const T &value)

Template parameters

ParameterDescription
TThe type of elements in the span

Arguments

ParameterTypeDescription
spanconst Span<T>&The span to search in
valueconst T&The value to count occurrences of

Return Value

The number of occurrences of the value in the span

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

Counts occurrences of a ReadOnlySpan in a Span

template<typename T> int32_t System::MemoryExtensions::Count(const Span<T> &span, const ReadOnlySpan<T> &value)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
spanconst Span<T>&The span to search in
valueconst ReadOnlySpan<T>&The span containing values to count occurrences of

Return Value

The number of occurrences of the value span in the target span

See Also