Bug 853988 - Move Conditional to the right place. r=froydnj
authorJeff Walden <jwalden@mit.edu>
Fri, 22 Mar 2013 00:20:41 -0700
changeset 126553 86d6a710f7fab017a42bdbaf2f8f81cbea8ab8fa
parent 126552 6aaed09c846d471508c8fb1b624abba45f13c6e1
child 126554 85dc97df0756101ed962c57c30f8e68273d8d4da
push id1644
push userjandemooij@gmail.com
push dateTue, 26 Mar 2013 20:03:56 +0000
reviewersfroydnj
bugs853988
milestone22.0a1
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>