/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/zone/zone-utils.h
34 строки
861 B
Michaël Zasso
deps: update V8 to 14.1.146.11
04 окт 2025, 19:47
Не верифицирован
04 окт 2025, 19:47
7772a2d
Код
Авторство
О чём код?
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_ZONE_ZONE_UTILS_H_ #define V8_ZONE_ZONE_UTILS_H_ #include <algorithm> #include <type_traits> #include "src/base/vector.h" #include "src/zone/zone.h" namespace v8 { namespace internal { template <typename T> base::Vector<T> CloneVector(Zone* zone, base::Vector<const T> other) { int length = other.length(); if (length == 0) return base::Vector<T>(); T* data = zone->AllocateArray<T>(length); if (std::is_trivially_copyable_v<T>) { MemCopy(data, other.data(), length * sizeof(T)); } else { std::copy(other.begin(), other.end(), data); } return base::Vector<T>(data, length); } } // namespace internal } // namespace v8 #endif // V8_ZONE_ZONE_UTILS_H_