[llvm] r229362 - Switch our index sequence away from template aliases and just use

Chandler Carruth chandlerc at gmail.com
Mon Feb 16 00:22:35 PST 2015


Author: chandlerc
Date: Mon Feb 16 02:22:35 2015
New Revision: 229362

URL: http://llvm.org/viewvc/llvm-project?rev=229362&view=rev
Log:
Switch our index sequence away from template aliases and just use
classes. We can't use template aliases because on MSVC they don't appear
to work correctly in the common usage such as Format.h.

Many thanks to Zach for doing all the testing and debugging here. I just
slotted the fix into the code.

Modified:
    llvm/trunk/include/llvm/ADT/STLExtras.h

Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=229362&r1=229361&r2=229362&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Mon Feb 16 02:22:35 2015
@@ -203,18 +203,18 @@ template <class T, T... I> struct intege
   static LLVM_CONSTEXPR size_t size() { return sizeof...(I); }
 };
 
+/// \brief Alias for the common case of a sequence of size_ts.
+template <size_t... I>
+struct index_sequence : integer_sequence<std::size_t, I...> {};
+
 template <std::size_t N, std::size_t... I>
 struct build_index_impl : build_index_impl<N - 1, N - 1, I...> {};
 template <std::size_t... I>
-struct build_index_impl<0, I...> : integer_sequence<std::size_t, I...> {};
-
-/// \brief Alias for the common case of a sequence of size_ts.
-template <size_t... I>
-using index_sequence = integer_sequence<std::size_t, I...>;
+struct build_index_impl<0, I...> : index_sequence<I...> {};
 
 /// \brief Creates a compile-time integer sequence for a parameter pack.
 template <class... Ts>
-using index_sequence_for = build_index_impl<sizeof...(Ts)>;
+struct index_sequence_for : build_index_impl<sizeof...(Ts)> {};
 
 //===----------------------------------------------------------------------===//
 //     Extra additions for arrays





More information about the llvm-commits mailing list