Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
v8::MemorySpan< T > Class Template Reference

#include <v8-memory-span.h>

Inheritance diagram for v8::MemorySpan< T >:
[legend]

Classes

class  Iterator
 

Public Member Functions

constexpr MemorySpan ()=default
 
constexpr MemorySpan (std::nullptr_t, size_t)
 
template<typename Iterator , std::enable_if_t< is_compatible_iterator_v< Iterator >, bool > = true>
constexpr MemorySpan (Iterator first, size_t count)
 
template<typename Iterator , std::enable_if_t< is_compatible_iterator_v< Iterator > &&!std::is_convertible_v< Iterator, size_t >, bool > = true>
constexpr MemorySpan (Iterator first, Iterator last)
 
template<size_t N>
constexpr MemorySpan (T(&a)[N]) noexcept
 
template<typename U , size_t N, std::enable_if_t< is_array_convertible_v< U, T >, bool > = true>
constexpr MemorySpan (std::array< U, N > &a) noexcept
 
template<typename U , size_t N, std::enable_if_t< is_array_convertible_v< const U, T >, bool > = true>
constexpr MemorySpan (const std::array< U, N > &a) noexcept
 
constexpr T * data () const
 
constexpr size_t size () const
 
constexpr T & operator[] (size_t i) const
 
constexpr bool empty () const
 
Iterator begin () const
 
Iterator end () const
 

Detailed Description

template<typename T>
class v8::MemorySpan< T >

Points to an unowned contiguous buffer holding a known number of elements.

This is similar to std::span (under consideration for C++20), but does not require advanced C++ support. In the (far) future, this may be replaced with or aliased to std::span.

To facilitate future migration, this class exposes a subset of the interface implemented by std::span.

Constructor & Destructor Documentation

◆ MemorySpan() [1/7]

template<typename T >
constexpr v8::MemorySpan< T >::MemorySpan ( )
constexprdefault

The default constructor creates an empty span.

◆ MemorySpan() [2/7]

template<typename T >
constexpr v8::MemorySpan< T >::MemorySpan ( std::nullptr_t  ,
size_t   
)
inlineconstexpr

Constructor from nullptr and count, for backwards compatibility. This is not compatible with C++20 std::span.

◆ MemorySpan() [3/7]

template<typename T >
template<typename Iterator , std::enable_if_t< is_compatible_iterator_v< Iterator >, bool > = true>
constexpr v8::MemorySpan< T >::MemorySpan ( Iterator  first,
size_t  count 
)
inlineconstexpr

Constructor from "iterator" and count.

◆ MemorySpan() [4/7]

template<typename T >
template<typename Iterator , std::enable_if_t< is_compatible_iterator_v< Iterator > &&!std::is_convertible_v< Iterator, size_t >, bool > = true>
constexpr v8::MemorySpan< T >::MemorySpan ( Iterator  first,
Iterator  last 
)
inlineconstexpr

Constructor from two "iterators".

◆ MemorySpan() [5/7]

template<typename T >
template<size_t N>
constexpr v8::MemorySpan< T >::MemorySpan ( T(&)  a[N])
inlineconstexprnoexcept

Implicit conversion from C-style array.

◆ MemorySpan() [6/7]

template<typename T >
template<typename U , size_t N, std::enable_if_t< is_array_convertible_v< U, T >, bool > = true>
constexpr v8::MemorySpan< T >::MemorySpan ( std::array< U, N > &  a)
inlineconstexprnoexcept

Implicit conversion from std::array.

◆ MemorySpan() [7/7]

template<typename T >
template<typename U , size_t N, std::enable_if_t< is_array_convertible_v< const U, T >, bool > = true>
constexpr v8::MemorySpan< T >::MemorySpan ( const std::array< U, N > &  a)
inlineconstexprnoexcept

Implicit conversion from const std::array.

Member Function Documentation

◆ begin()

template<typename T >
Iterator v8::MemorySpan< T >::begin ( ) const
inline

◆ data()

template<typename T >
constexpr T * v8::MemorySpan< T >::data ( ) const
inlineconstexpr

Returns a pointer to the beginning of the buffer.

◆ empty()

template<typename T >
constexpr bool v8::MemorySpan< T >::empty ( ) const
inlineconstexpr

Returns true if the buffer is empty.

◆ end()

template<typename T >
Iterator v8::MemorySpan< T >::end ( ) const
inline

◆ operator[]()

template<typename T >
constexpr T & v8::MemorySpan< T >::operator[] ( size_t  i) const
inlineconstexpr

◆ size()

template<typename T >
constexpr size_t v8::MemorySpan< T >::size ( ) const
inlineconstexpr

Returns the number of elements that the buffer holds.


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