v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
runtime-support.h
Go to the documentation of this file.
1// Copyright 2019 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 V8_TORQUE_RUNTIME_SUPPORT_H_
6#define V8_TORQUE_RUNTIME_SUPPORT_H_
7
8#include <type_traits>
9
10template <class T>
11struct Identity {
12 using type = T;
13};
14
15template <class T>
16struct UnderlyingTypeHelper : Identity<typename std::underlying_type<T>::type> {
17};
18
19template <class T>
21 typename std::conditional_t<std::is_enum<T>::value, UnderlyingTypeHelper<T>,
23
24// Utility for extracting the underlying type of an enum, returns the type
25// itself if not an enum.
26template <class T>
30
31#endif // V8_TORQUE_RUNTIME_SUPPORT_H_
#define T
int x
typename std::conditional_t< std::is_enum< T >::value, UnderlyingTypeHelper< T >, Identity< T > >::type UnderlyingTypeIfEnum
UnderlyingTypeIfEnum< T > CastToUnderlyingTypeIfEnum(T x)
wasm::ValueType type