Switch our index sequence away from template aliases and just use
authorChandler Carruth <chandlerc@gmail.com>
Mon, 16 Feb 2015 08:22:35 +0000 (08:22 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 16 Feb 2015 08:22:35 +0000 (08:22 +0000)
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.

llvm-svn: 229362

llvm/include/llvm/ADT/STLExtras.h

index ed77385..57af18e 100644 (file)
@@ -203,18 +203,18 @@ template <class T, T... I> struct integer_sequence {
   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