K-ballo created this revision.
K-ballo added reviewers: mclow.lists, EricWF, majnemer, rsmith.
K-ballo added a subscriber: cfe-commits.

Use the `__make_integer_seq` builtin, introduced by r252036, when available. 
This allows for an incredibly fast `std::make_integer_sequence` implementation.

http://reviews.llvm.org/D14814

Files:
  include/utility

Index: include/utility
===================================================================
--- include/utility
+++ include/utility
@@ -680,6 +680,16 @@
 template<size_t... _Ip>
     using index_sequence = integer_sequence<size_t, _Ip...>;
 
+#if __has_builtin(__make_integer_seq)
+
+template <class _Tp, _Tp _Ep>
+struct __make_integer_sequence
+{
+    typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
+};
+
+#else
+
 namespace __detail {
 
 template<typename _Tp, size_t ..._Extra> struct __repeat;
@@ -737,6 +747,8 @@
     typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
 };
 
+#endif
+
 template<class _Tp, _Tp _Np>
     using make_integer_sequence = typename __make_integer_sequence<_Tp, 
_Np>::type;
 


Index: include/utility
===================================================================
--- include/utility
+++ include/utility
@@ -680,6 +680,16 @@
 template<size_t... _Ip>
     using index_sequence = integer_sequence<size_t, _Ip...>;
 
+#if __has_builtin(__make_integer_seq)
+
+template <class _Tp, _Tp _Ep>
+struct __make_integer_sequence
+{
+    typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
+};
+
+#else
+
 namespace __detail {
 
 template<typename _Tp, size_t ..._Extra> struct __repeat;
@@ -737,6 +747,8 @@
     typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
 };
 
+#endif
+
 template<class _Tp, _Tp _Np>
     using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to