libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

remove_extent.pass.cpp (1327B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // type_traits
     11 
     12 // remove_extent
     13 
     14 #include <type_traits>
     15 
     16 #include "test_macros.h"
     17 
     18 enum Enum {zero, one_};
     19 
     20 template <class T, class U>
     21 void test_remove_extent()
     22 {
     23     static_assert((std::is_same<typename std::remove_extent<T>::type, U>::value), "");
     24 #if TEST_STD_VER > 11
     25     static_assert((std::is_same<std::remove_extent_t<T>,     U>::value), "");
     26 #endif
     27 }
     28 
     29 
     30 int main()
     31 {
     32     test_remove_extent<int, int> ();
     33     test_remove_extent<const Enum, const Enum> ();
     34     test_remove_extent<int[], int> ();
     35     test_remove_extent<const int[], const int> ();
     36     test_remove_extent<int[3], int> ();
     37     test_remove_extent<const int[3], const int> ();
     38     test_remove_extent<int[][3], int[3]> ();
     39     test_remove_extent<const int[][3], const int[3]> ();
     40     test_remove_extent<int[2][3], int[3]> ();
     41     test_remove_extent<const int[2][3], const int[3]> ();
     42     test_remove_extent<int[1][2][3], int[2][3]> ();
     43     test_remove_extent<const int[1][2][3], const int[2][3]> ();
     44 }