Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: base/template_util.h

Issue 2797793002: Remove base::underlying_type, replace uses with std::underlying_type (Closed)
Patch Set: underlyingtype: rm-tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/numerics/safe_conversions_impl.h ('k') | base/template_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TEMPLATE_UTIL_H_ 5 #ifndef BASE_TEMPLATE_UTIL_H_
6 #define BASE_TEMPLATE_UTIL_H_ 6 #define BASE_TEMPLATE_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <type_traits> 10 #include <type_traits>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 template <typename T, typename = void> 57 template <typename T, typename = void>
58 struct SupportsOstreamOperator : std::false_type {}; 58 struct SupportsOstreamOperator : std::false_type {};
59 template <typename T> 59 template <typename T>
60 struct SupportsOstreamOperator<T, 60 struct SupportsOstreamOperator<T,
61 decltype(void(std::declval<std::ostream&>() 61 decltype(void(std::declval<std::ostream&>()
62 << std::declval<T>()))> 62 << std::declval<T>()))>
63 : std::true_type {}; 63 : std::true_type {};
64 64
65 } // namespace internal 65 } // namespace internal
66 66
67 // underlying_type produces the integer type backing an enum type.
68 // TODO(crbug.com/554293): Remove this when all platforms have this in the std
69 // namespace.
70 #if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
71 template <typename T>
72 struct underlying_type {
73 using type = __underlying_type(T);
74 };
75 #else
76 template <typename T>
77 using underlying_type = std::underlying_type<T>;
78 #endif
79
80 // TODO(crbug.com/554293): Remove this when all platforms have this in the std 67 // TODO(crbug.com/554293): Remove this when all platforms have this in the std
81 // namespace. 68 // namespace.
82 #if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX) 69 #if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
83 template <class T> 70 template <class T>
84 using is_trivially_destructible = std::has_trivial_destructor<T>; 71 using is_trivially_destructible = std::has_trivial_destructor<T>;
85 #else 72 #else
86 template <class T> 73 template <class T>
87 using is_trivially_destructible = std::is_trivially_destructible<T>; 74 using is_trivially_destructible = std::is_trivially_destructible<T>;
88 #endif 75 #endif
89 76
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 using is_trivially_copyable = std::is_trivially_copyable<T>; 117 using is_trivially_copyable = std::is_trivially_copyable<T>;
131 #endif 118 #endif
132 119
133 } // namespace base 120 } // namespace base
134 121
135 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX 122 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
136 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 123 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
137 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 124 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
138 125
139 #endif // BASE_TEMPLATE_UTIL_H_ 126 #endif // BASE_TEMPLATE_UTIL_H_
OLDNEW
« no previous file with comments | « base/numerics/safe_conversions_impl.h ('k') | base/template_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698