CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::Span< T > Class Template Reference

Represents a contiguous region of arbitrary memory similar to C++20's std::span. More...

#include <span.h>

Inherits System::Details::SpanCore< T, Span< T >, Span< T > >.

Public Member Functions

void Clear () const
 Clears the contents of the span by setting all elements to default value. More...
 
void Fill (const T &value) const
 Fills the span with the specified value. More...
 

Static Public Member Functions

static ThisType to_Span (const typename BaseType::ArrayPtrT &array)
 Converts an array to a Span. More...
 

Detailed Description

template<typename T>
class System::Span< T >

Represents a contiguous region of arbitrary memory similar to C++20's std::span.

Template Parameters
TThe type of elements in the span. This class provides a type-safe way to work with contiguous sequences of objects. It can be used to wrap arrays, stack arrays, or raw pointers while maintaining bounds checking. The Span doesn't own the memory it points to - it's just a view into existing memory.

Member Function Documentation

◆ Clear()

template<typename T >
void System::Span< T >::Clear ( ) const
inline

Clears the contents of the span by setting all elements to default value.

◆ Fill()

template<typename T >
void System::Span< T >::Fill ( const T &  value) const
inline

Fills the span with the specified value.

Parameters
valueThe value to assign to each element of the span.

◆ to_Span()

template<typename T >
static ThisType System::Span< T >::to_Span ( const typename BaseType::ArrayPtrT &  array)
inlinestatic

Converts an array to a Span.

Parameters
arrayThe array to convert.
Returns
A span representing the array.