Title: [231353] trunk/Source/WTF
- Revision
- 231353
- Author
- an...@apple.com
- Date
- 2018-05-04 08:35:29 -0700 (Fri, 04 May 2018)
Log Message
OptionsSet initializer list constructor should be constexpr
https://bugs.webkit.org/show_bug.cgi?id=185298
Reviewed by Anders Carlsson.
* wtf/OptionSet.h:
(WTF::OptionSet::OptionSet):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (231352 => 231353)
--- trunk/Source/WTF/ChangeLog 2018-05-04 15:18:34 UTC (rev 231352)
+++ trunk/Source/WTF/ChangeLog 2018-05-04 15:35:29 UTC (rev 231353)
@@ -1,3 +1,13 @@
+2018-05-04 Antti Koivisto <an...@apple.com>
+
+ OptionsSet initializer list constructor should be constexpr
+ https://bugs.webkit.org/show_bug.cgi?id=185298
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/OptionSet.h:
+ (WTF::OptionSet::OptionSet):
+
2018-05-03 Yusuke Suzuki <utatane....@gmail.com>
Use default std::optional if it is provided
Modified: trunk/Source/WTF/wtf/OptionSet.h (231352 => 231353)
--- trunk/Source/WTF/wtf/OptionSet.h 2018-05-04 15:18:34 UTC (rev 231352)
+++ trunk/Source/WTF/wtf/OptionSet.h 2018-05-04 15:35:29 UTC (rev 231353)
@@ -78,6 +78,12 @@
: m_storage(static_cast<StorageType>(t))
{
}
+
+ constexpr OptionSet(std::initializer_list<T> initializerList)
+ {
+ for (auto& option : initializerList)
+ m_storage |= static_cast<StorageType>(option);
+ }
#else
OptionSet(T t)
: m_storage(static_cast<StorageType>(t))
@@ -84,10 +90,7 @@
{
ASSERT_WITH_MESSAGE(hasOneBitSet(static_cast<StorageType>(t)), "Enumerator is not a positive power of two.");
}
-#endif
- // FIXME: Make this constexpr once we adopt C++14 as C++11 does not support for-loops
- // in a constexpr function.
OptionSet(std::initializer_list<T> initializerList)
{
for (auto& option : initializerList) {
@@ -95,6 +98,7 @@
m_storage |= static_cast<StorageType>(option);
}
}
+#endif
constexpr StorageType toRaw() const { return m_storage; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes