Bug 853988 - Move Conditional to the right place. r=froydnj
authorJeff Walden <jwalden@mit.edu>
Fri, 22 Mar 2013 00:20:41 -0700
changeset 136547 86d6a710f7fab017a42bdbaf2f8f81cbea8ab8fa
parent 136546 6aaed09c846d471508c8fb1b624abba45f13c6e1
child 136548 85dc97df0756101ed962c57c30f8e68273d8d4da
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs853988
milestone22.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 853988 - Move Conditional to the right place. r=froydnj
mfbt/TypeTraits.h
--- a/mfbt/TypeTraits.h
+++ b/mfbt/TypeTraits.h
@@ -208,34 +208,16 @@ struct IsConvertible
 
 /* 20.9.7.4 Array modifications */
 
 /* 20.9.7.5 Pointer modifications */
 
 /* 20.9.7.6 Other transformations */
 
 /**
- * Conditional selects a class between two, depending on a given boolean value.
- *
- * mozilla::Conditional<true, A, B>::Type is A;
- * mozilla::Conditional<false, A, B>::Type is B;
- */
-template<bool Condition, typename A, typename B>
-struct Conditional
-{
-    typedef A Type;
-};
-
-template<class A, class B>
-struct Conditional<false, A, B>
-{
-    typedef B Type;
-};
-
-/**
  * EnableIf is a struct containing a typedef of T if and only if B is true.
  *
  * mozilla::EnableIf<true, int>::Type is int;
  * mozilla::EnableIf<false, int>::Type is a compile-time error.
  *
  * Use this template to implement SFINAE-style (Substitution Failure Is not An
  * Error) requirements.  For example, you might use it to impose a restriction
  * on a template parameter:
@@ -254,16 +236,34 @@ struct EnableIf
 
 template<typename T>
 struct EnableIf<true, T>
 {
     typedef T Type;
 };
 
 /**
+ * Conditional selects a class between two, depending on a given boolean value.
+ *
+ * mozilla::Conditional<true, A, B>::Type is A;
+ * mozilla::Conditional<false, A, B>::Type is B;
+ */
+template<bool Condition, typename A, typename B>
+struct Conditional
+{
+    typedef A Type;
+};
+
+template<class A, class B>
+struct Conditional<false, A, B>
+{
+    typedef B Type;
+};
+
+/**
  * Traits class for identifying POD types.  Until C++11 there's no automatic
  * way to detect PODs, so for the moment this is done manually.  Users may
  * define specializations of this class that inherit from mozilla::TrueType and
  * mozilla::FalseType (or equivalently mozilla::IntegralConstant<bool, true or
  * false>, or conveniently from mozilla::IsPod for composite types) as needed to
  * ensure correct IsPod behavior.
  */
 template<typename T>