OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 template<class T, size_t n> struct is_array<T[n]> : public true_type {}; | 41 template<class T, size_t n> struct is_array<T[n]> : public true_type {}; |
42 template<class T> struct is_array<T[]> : public true_type {}; | 42 template<class T> struct is_array<T[]> : public true_type {}; |
43 | 43 |
44 template <class T> struct is_non_const_reference : false_type {}; | 44 template <class T> struct is_non_const_reference : false_type {}; |
45 template <class T> struct is_non_const_reference<T&> : true_type {}; | 45 template <class T> struct is_non_const_reference<T&> : true_type {}; |
46 template <class T> struct is_non_const_reference<const T&> : false_type {}; | 46 template <class T> struct is_non_const_reference<const T&> : false_type {}; |
47 | 47 |
48 template <class T> struct is_void : false_type {}; | 48 template <class T> struct is_void : false_type {}; |
49 template <> struct is_void<void> : true_type {}; | 49 template <> struct is_void<void> : true_type {}; |
50 | 50 |
51 template <class T> | 51 // Helper useful for converting a tuple to variadic template function |
52 struct remove_reference { | 52 // arguments. |
53 typedef T type; | 53 // |
54 }; | 54 // sequence_generator<3>::type will be sequence<0, 1, 2>. |
55 template <class T> | 55 template <int...> |
56 struct remove_reference<T&> { | 56 struct sequence {}; |
57 typedef T type; | 57 template <int N, int... S> |
58 }; | 58 struct sequence_generator : sequence_generator<N - 1, N - 1, S...> {}; |
59 template <class T> | 59 template <int... S> |
60 struct remove_reference<T&&> { | 60 struct sequence_generator<0, S...> { |
61 typedef T type; | 61 typedef sequence<S...> type; |
62 }; | 62 }; |
63 | 63 |
64 namespace internal { | 64 namespace internal { |
65 | 65 |
66 // Types YesType and NoType are guaranteed such that sizeof(YesType) < | 66 // Types YesType and NoType are guaranteed such that sizeof(YesType) < |
67 // sizeof(NoType). | 67 // sizeof(NoType). |
68 typedef char YesType; | 68 typedef char YesType; |
69 | 69 |
70 struct NoType { | 70 struct NoType { |
71 YesType dummy[2]; | 71 YesType dummy[2]; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 template <typename T> | 118 template <typename T> |
119 struct is_class | 119 struct is_class |
120 : integral_constant<bool, | 120 : integral_constant<bool, |
121 sizeof(internal::IsClassHelper::Test<T>(0)) == | 121 sizeof(internal::IsClassHelper::Test<T>(0)) == |
122 sizeof(internal::YesType)> { | 122 sizeof(internal::YesType)> { |
123 }; | 123 }; |
124 | 124 |
125 } // namespace rtc | 125 } // namespace rtc |
126 | 126 |
127 #endif // WEBRTC_BASE_TEMPLATE_UTIL_H_ | 127 #endif // WEBRTC_BASE_TEMPLATE_UTIL_H_ |
OLD | NEW |