Loading...
Searching...
No Matches
v8-memory-span.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_MEMORY_SPAN_H_
6#define INCLUDE_V8_MEMORY_SPAN_H_
7
8#include <array>
9#include <span>
10
11#include "v8config.h" // NOLINT(build/include_directory)
12
13namespace v8 {
14
21template <typename T>
22using MemorySpan = std::span<T>;
23
35template <typename T, std::size_t N>
36[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) {
37 return std::to_array(a);
38}
39
40template <typename T, std::size_t N>
41[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array(
42 T (&&a)[N]) {
43 return std::to_array(std::move(a));
44}
45
46} // namespace v8
47
48#endif // INCLUDE_V8_MEMORY_SPAN_H_
Definition: libplatform.h:15
std::span< T > MemorySpan
Definition: v8-memory-span.h:22
constexpr std::array< std::remove_cv_t< T >, N > to_array(T(&a)[N])
Definition: v8-memory-span.h:36