// Copyright 2019 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_TORQUE_RUNTIME_SUPPORT_H_ #define V8_TORQUE_RUNTIME_SUPPORT_H_ #include template struct Identity { using type = T; }; template struct UnderlyingTypeHelper : Identity::type> { }; template using UnderlyingTypeIfEnum = typename std::conditional_t::value, UnderlyingTypeHelper, Identity>::type; // Utility for extracting the underlying type of an enum, returns the type // itself if not an enum. template UnderlyingTypeIfEnum CastToUnderlyingTypeIfEnum(T x) { return static_cast>(x); } #endif // V8_TORQUE_RUNTIME_SUPPORT_H_