From 9743af6e31eb0699ded017ac1f957a4a6fe78bf6 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 30 Jun 2016 22:34:43 +0000 Subject: [PATCH] Replace __make_tuple_indices implementation with superior implementation. The previous __make_tuple_indices implementation caused O(N) instantiations and was pretty inefficient. The C++14 __make_integer_sequence implementation is much better, since it either uses a builtin to generate the sequence or a very nice Log8(N) implementation provided by richard smith. This patch moves the __make_integer_sequence implementation into __tuple and uses it to implement __make_tuple_indices. Since libc++ can't expose the name 'integer_sequence' in C++11 this patch also introduces a dummy type '__integer_sequence' which is used when generating the sequence. One the sequence is generated '__integer_sequence' can be converted into the required type; either '__tuple_indices' or 'integer_sequence'. llvm-svn: 274286 --- libcxx/include/__tuple | 99 +++++++++++++++++++++++++++++++----------- libcxx/include/utility | 59 +++---------------------- 2 files changed, 81 insertions(+), 77 deletions(-) diff --git a/libcxx/include/__tuple b/libcxx/include/__tuple index 09c68393aed1..53afb18569f3 100644 --- a/libcxx/include/__tuple +++ b/libcxx/include/__tuple @@ -68,6 +68,80 @@ template struct __tuple_like : public __tuple_li // tuple specializations #if !defined(_LIBCPP_HAS_NO_VARIADICS) + +template struct __tuple_indices {}; + +template +struct __integer_sequence { + template