forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_all_extents.h
38 lines (32 loc) · 1.35 KB
/
remove_all_extents.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- remove_all_extents type_traits --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
#include "src/__support/CPP/type_traits/type_identity.h"
#include <stddef.h> // size_t
namespace LIBC_NAMESPACE::cpp {
// remove_all_extents
#if __has_builtin(__remove_all_extents)
template <typename T> using remove_all_extents_t = __remove_all_extents(T);
template <typename T>
struct remove_all_extents : cpp::type_identity<remove_all_extents_t<T>> {};
#else
template <typename T> struct remove_all_extents {
using type = T;
};
template <typename T> struct remove_all_extents<T[]> {
using type = typename remove_all_extents<T>::type;
};
template <typename T, size_t _Np> struct remove_all_extents<T[_Np]> {
using type = typename remove_all_extents<T>::type;
};
template <typename T>
using remove_all_extents_t = typename remove_all_extents<T>::type;
#endif
} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H