Bug 1325351 part 2 - Simplify 'Some' function. r=froydnj
authorXidorn Quan <me@upsuper.org>
Fri, 23 Dec 2016 11:32:33 +1100
changeset 327518 134d3abde30cabf888b1e8b9a4dadd94cd872482
parent 327517 a5917e9614e49308f6e9963ee6c38517fef48416
child 327519 42fa5226e92c56bf0f59a8fb5562f9e0e73c3521
push id85215
push userkwierso@gmail.com
push dateThu, 29 Dec 2016 20:22:31 +0000
treeherdermozilla-inbound@1539be3e8e5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1325351
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1325351 part 2 - Simplify 'Some' function. r=froydnj MozReview-Commit-ID: AkLVQw9WYwy
mfbt/Maybe.h
--- a/mfbt/Maybe.h
+++ b/mfbt/Maybe.h
@@ -433,21 +433,22 @@ public:
  * move constructor, it's used to make this as efficient as possible.
  *
  * Some() selects the type of Maybe it returns by removing any const, volatile,
  * or reference qualifiers from the type of the value you pass to it. This gives
  * it more intuitive behavior when used in expressions, but it also means that
  * if you need to construct a Maybe value that holds a const, volatile, or
  * reference value, you need to use emplace() instead.
  */
-template<typename T>
-Maybe<typename RemoveCV<typename RemoveReference<T>::Type>::Type>
+template<typename T,
+         typename U = typename std::remove_cv<
+           typename std::remove_reference<T>::type>::type>
+Maybe<U>
 Some(T&& aValue)
 {
-  typedef typename RemoveCV<typename RemoveReference<T>::Type>::Type U;
   Maybe<U> value;
   value.emplace(Forward<T>(aValue));
   return value;
 }
 
 template<typename T>
 Maybe<typename RemoveCV<typename RemoveReference<T>::Type>::Type>
 ToMaybe(T* aPtr)