Bug 1325351 part 2 - Simplify 'Some' function. r=froydnj
☠☠ backed out by d9c389a8bcbf ☠ ☠
authorXidorn Quan <me@upsuper.org>
Fri, 23 Dec 2016 11:32:33 +1100
changeset 327361 79754b9b89b744325ea773c83185a4520bdbd632
parent 327360 b4d189ca8add5a3b5fd27d8e3b7d42c812a195d0
child 327362 45f0755ff471c8204229c95627e60b55cd971748
push id85168
push userphilringnalda@gmail.com
push dateWed, 28 Dec 2016 04:38:14 +0000
treeherdermozilla-inbound@197d0e1032b9 [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)