[PATCH] D14814: [libcxx] Use __make_integer_seq builtin when available

Agustín Bergé via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 03:54:53 PST 2015


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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14814.40624.patch
Type: text/x-patch
Size: 728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151119/0e7fde1e/attachment.bin>


More information about the cfe-commits mailing list