v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1// Copyright 2024 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_BASE_TEMPLATE_META_PROGRAMMING_COMMON_H_
6#define V8_BASE_TEMPLATE_META_PROGRAMMING_COMMON_H_
7
8#include <type_traits>
9
10#define TYPENAME1 \
11 template <typename> \
12 typename
13
14namespace v8::base::tmp {
15
16template <typename T, typename U>
17struct equals : std::bool_constant<false> {};
18template <typename T>
19struct equals<T, T> : std::bool_constant<true> {};
20
21template <TYPENAME1 T, TYPENAME1 U>
22struct equals1 : std::bool_constant<false> {};
23template <TYPENAME1 T>
24struct equals1<T, T> : std::bool_constant<true> {};
25
26template <TYPENAME1 T, typename U>
28 using type = T<U>;
29};
30
31template <typename I, TYPENAME1 T>
32struct is_instantiation_of : std::bool_constant<false> {};
33template <typename U, TYPENAME1 T>
34struct is_instantiation_of<T<U>, T> : std::bool_constant<true> {};
35
36} // namespace v8::base::tmp
37
38#undef TYPENAME1
39
40#endif // V8_BASE_TEMPLATE_META_PROGRAMMING_COMMON_H_