Foundation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Foundation::Core::Span< T > Class Template Reference

std::span with relaxed constructors for pointer-aliasing types and common containers. More...

#include <Container.hpp>

Inheritance diagram for Foundation::Core::Span< T >:

Public Member Functions

 Span ()=default
 
template<typename U >
requires (sizeof(std::remove_reference<T>) == sizeof(std::remove_reference<U>) && std::is_convertible_v<U*, T*>)
 Span (U *data, size_t size)
 Relaxed ctor for pointer-aliasing types.
 
template<typename U , size_t Size>
 Span (U(&array)[Size])
 Relaxed ctor for C-style arrays.
 
template<typename U >
requires requires (U a) { a.data(); a.size(); }
 Span (U &array)
 Relaxed ctor for contiguous STL containers.
 
template<typename U >
requires std::is_convertible_v<U*, T*>
 Span (U &item)
 Shorthand for single l-value item.
 
Span< const charAsBytes () const
 Provides casting to a byte-level view of the underlying data.
 

Detailed Description

template<typename T>
class Foundation::Core::Span< T >

std::span with relaxed constructors for pointer-aliasing types and common containers.

Constructor & Destructor Documentation

◆ Span() [1/5]

template<typename T >
Foundation::Core::Span< T >::Span ( )
default

◆ Span() [2/5]

template<typename T >
template<typename U >
requires (sizeof(std::remove_reference<T>) == sizeof(std::remove_reference<U>) && std::is_convertible_v<U*, T*>)
Foundation::Core::Span< T >::Span ( U data,
size_t  size 
)
inline

Relaxed ctor for pointer-aliasing types.

◆ Span() [3/5]

template<typename T >
template<typename U , size_t Size>
Foundation::Core::Span< T >::Span ( U(&)  array[Size])
inline

Relaxed ctor for C-style arrays.

For initializer lists, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2447r4.html i.e. StlSpan<const T>({ { 1, 2, 3 } })

◆ Span() [4/5]

template<typename T >
template<typename U >
requires requires (U a) { a.data(); a.size(); }
Foundation::Core::Span< T >::Span ( U array)
inline

Relaxed ctor for contiguous STL containers.

◆ Span() [5/5]

template<typename T >
template<typename U >
requires std::is_convertible_v<U*, T*>
Foundation::Core::Span< T >::Span ( U item)
inline

Shorthand for single l-value item.

Member Function Documentation

◆ AsBytes()

template<typename T >
Span< const char > Foundation::Core::Span< T >::AsBytes ( ) const
inline

Provides casting to a byte-level view of the underlying data.


The documentation for this class was generated from the following file: