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

Unified Diff: webrtc/base/safe_minmax.h

Issue 2916083003: SafeMin/SafeMax: Fix wrong return type when given two enum arguments (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/base/safe_minmax_unittest.cc » ('j') | webrtc/base/safe_minmax_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/safe_minmax.h
diff --git a/webrtc/base/safe_minmax.h b/webrtc/base/safe_minmax.h
index 8d1fc8776fe3b0779ab945d2f535697926b5bae9..16638efc617feb6a38bdd8ae704a9ca153e725ce 100644
--- a/webrtc/base/safe_minmax.h
+++ b/webrtc/base/safe_minmax.h
@@ -153,13 +153,15 @@ struct TypeOr {
} // namespace safe_minmax_impl
-template <typename R = safe_minmax_impl::DefaultType,
- typename T1 = safe_minmax_impl::DefaultType,
- typename T2 = safe_minmax_impl::DefaultType,
- typename R2 = typename safe_minmax_impl::TypeOr<
- R,
- typename safe_minmax_impl::UnderlyingType<
- typename safe_minmax_impl::MType<T1, T2>::min_t>::type>::type>
+template <
+ typename R = safe_minmax_impl::DefaultType,
+ typename T1 = safe_minmax_impl::DefaultType,
+ typename T2 = safe_minmax_impl::DefaultType,
+ typename R2 = typename safe_minmax_impl::TypeOr<
+ R,
+ typename safe_minmax_impl::MType<
+ typename safe_minmax_impl::UnderlyingType<T1>::type,
+ typename safe_minmax_impl::UnderlyingType<T2>::type>::min_t>::type>
constexpr R2 SafeMin(T1 a, T2 b) {
static_assert(IsIntlike<T1>::value || std::is_floating_point<T1>::value,
"The first argument must be integral or floating-point");
@@ -168,13 +170,15 @@ constexpr R2 SafeMin(T1 a, T2 b) {
return safe_cmp::Lt(a, b) ? static_cast<R2>(a) : static_cast<R2>(b);
}
-template <typename R = safe_minmax_impl::DefaultType,
- typename T1 = safe_minmax_impl::DefaultType,
- typename T2 = safe_minmax_impl::DefaultType,
- typename R2 = typename safe_minmax_impl::TypeOr<
- R,
- typename safe_minmax_impl::UnderlyingType<
- typename safe_minmax_impl::MType<T1, T2>::max_t>::type>::type>
+template <
+ typename R = safe_minmax_impl::DefaultType,
+ typename T1 = safe_minmax_impl::DefaultType,
+ typename T2 = safe_minmax_impl::DefaultType,
+ typename R2 = typename safe_minmax_impl::TypeOr<
+ R,
+ typename safe_minmax_impl::MType<
+ typename safe_minmax_impl::UnderlyingType<T1>::type,
+ typename safe_minmax_impl::UnderlyingType<T2>::type>::max_t>::type>
constexpr R2 SafeMax(T1 a, T2 b) {
static_assert(IsIntlike<T1>::value || std::is_floating_point<T1>::value,
"The first argument must be integral or floating-point");
« no previous file with comments | « no previous file | webrtc/base/safe_minmax_unittest.cc » ('j') | webrtc/base/safe_minmax_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698