Bug 1319016 - Part2 - Make IsVariant class use IntegralConstant as true false type. draft
authorJames Cheng <jacheng@mozilla.com>
Mon, 21 Nov 2016 14:28:49 +0800
changeset 441888 26a5557d69657f164a82af03a082a5577e4467c8
parent 441887 3a82b1b2e192eb8def0f46e958b63d3b9f7b0331
child 537656 59eaf09ee050d664f25a9011f867b962ceda08c2
push id36540
push userbmo:jacheng@mozilla.com
push dateMon, 21 Nov 2016 09:40:16 +0000
bugs1319016
milestone53.0a1
Bug 1319016 - Part2 - Make IsVariant class use IntegralConstant as true false type. MozReview-Commit-ID: G4ohbnUy049
mfbt/Variant.h
--- a/mfbt/Variant.h
+++ b/mfbt/Variant.h
@@ -44,26 +44,20 @@ struct MaxSizeOf<T>
 // `mozilla::EnableIf` to catch passing non-variant types to `Variant::is<T>()`
 // and friends at compile time, rather than at runtime. It ensures that the
 // given type `Needle` is one of the types in the set of types `Haystack`.
 
 template<typename Needle, typename... Haystack>
 struct IsVariant;
 
 template<typename Needle>
-struct IsVariant<Needle>
-{
-  static const bool value = false;
-};
+struct IsVariant<Needle> : FalseType {};
 
 template<typename Needle, typename... Haystack>
-struct IsVariant<Needle, Needle, Haystack...>
-{
-  static const bool value = true;
-};
+struct IsVariant<Needle, Needle, Haystack...> : TrueType {};
 
 template<typename Needle, typename T, typename... Haystack>
 struct IsVariant<Needle, T, Haystack...> : public IsVariant<Needle, Haystack...> { };
 
 /// SelectVariantTypeHelper is used in the implementation of SelectVariantType.
 template<typename T, typename... Variants>
 struct SelectVariantTypeHelper;