zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob bc577ca6 (1460B) - Raw


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