![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <v8-memory-span.h>
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 |
Private Types | |
template<typename From , typename To > | |
using | is_array_convertible = std::is_convertible<From (*)[], To (*)[]> |
template<typename It > | |
using | iter_reference_t = decltype(*std::declval<It&>()) |
Static Private Member Functions | |
template<typename U > | |
static constexpr U * | to_address (U *p) noexcept |
template<typename It , typename = std::void_t<decltype(std::declval<It&>().operator->())>> | |
static constexpr auto | to_address (It it) noexcept |
Private Attributes | |
T * | data_ = nullptr |
size_t | size_ = 0 |
Static Private Attributes | |
template<typename From , typename To > | |
static constexpr bool | is_array_convertible_v |
template<typename It > | |
static constexpr bool | is_compatible_iterator_v |
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.
Definition at line 64 of file v8-memory-span.h.
|
private |
Some C++ machinery, brought from the future.
Definition at line 68 of file v8-memory-span.h.
|
private |
Definition at line 74 of file v8-memory-span.h.
|
constexprdefault |
The default constructor creates an empty span.
|
inlineconstexpr |
Constructor from nullptr and count, for backwards compatibility. This is not compatible with C++20 std::span.
Definition at line 108 of file v8-memory-span.h.
|
inlineconstexpr |
Constructor from "iterator" and count.
Definition at line 113 of file v8-memory-span.h.
|
inlineconstexpr |
Constructor from two "iterators".
Definition at line 122 of file v8-memory-span.h.
|
inlineconstexprnoexcept |
Implicit conversion from C-style array.
Definition at line 128 of file v8-memory-span.h.
|
inlineconstexprnoexcept |
Implicit conversion from std::array.
Definition at line 134 of file v8-memory-span.h.
|
inlineconstexprnoexcept |
Implicit conversion from const std::array.
Definition at line 141 of file v8-memory-span.h.
|
inlinenodiscard |
Definition at line 277 of file v8-memory-span.h.
|
inlinenodiscardconstexpr |
Returns a pointer to the beginning of the buffer.
Definition at line 146 of file v8-memory-span.h.
|
inlinenodiscardconstexpr |
Returns true if the buffer is empty.
Definition at line 153 of file v8-memory-span.h.
|
inlinenodiscard |
Definition at line 278 of file v8-memory-span.h.
|
inlinenodiscardconstexpr |
Definition at line 150 of file v8-memory-span.h.
|
inlinenodiscardconstexpr |
Returns the number of elements that the buffer holds.
Definition at line 148 of file v8-memory-span.h.
|
inlinestaticnodiscardconstexprprivatenoexcept |
Definition at line 97 of file v8-memory-span.h.
|
inlinestaticnodiscardconstexprprivatenoexcept |
Definition at line 91 of file v8-memory-span.h.
|
private |
Definition at line 281 of file v8-memory-span.h.
|
staticconstexprprivate |
Definition at line 70 of file v8-memory-span.h.
|
staticconstexprprivate |
Definition at line 87 of file v8-memory-span.h.
|
private |
Definition at line 282 of file v8-memory-span.h.