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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229362 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth 2015-02-16 08:22:35 +00:00
parent 815c05d38c
commit d99cd97f85

View 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