Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // type_traits |
| 11 | |
| 12 | // remove_pointer |
| 13 | |
| 14 | #include <type_traits> |
| 15 | |
| 16 | template <class T, class U> |
| 17 | void test_remove_pointer() |
| 18 | { |
| 19 | static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), ""); |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 20 | #if _LIBCPP_STD_VER > 11 |
Marshall Clow | 933afa9 | 2013-07-04 00:10:01 +0000 | [diff] [blame] | 21 | static_assert((std::is_same<std::remove_pointer_t<T>, U>::value), ""); |
| 22 | #endif |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | test_remove_pointer<void, void>(); |
| 28 | test_remove_pointer<int, int>(); |
| 29 | test_remove_pointer<int[3], int[3]>(); |
| 30 | test_remove_pointer<int*, int>(); |
| 31 | test_remove_pointer<const int*, const int>(); |
| 32 | test_remove_pointer<int**, int*>(); |
| 33 | test_remove_pointer<int** const, int*>(); |
| 34 | test_remove_pointer<int*const * , int* const>(); |
| 35 | test_remove_pointer<const int** , const int*>(); |
| 36 | |
| 37 | test_remove_pointer<int&, int&>(); |
| 38 | test_remove_pointer<const int&, const int&>(); |
| 39 | test_remove_pointer<int(&)[3], int(&)[3]>(); |
| 40 | test_remove_pointer<int(*)[3], int[3]>(); |
| 41 | test_remove_pointer<int*&, int*&>(); |
| 42 | test_remove_pointer<const int*&, const int*&>(); |
| 43 | } |