X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FADT%2FSTLExtras.h;h=265cffd4c19857dd91d94ddf58c8a8a53176c67d;hp=804bdae0c7c83a40687ef3e1ff64c479b3a7d880;hb=aee01b35e4156316681a3f74042d00f701441068;hpb=d898d31ebc4de1ca54013afd28d803d84dab3aa1 diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 804bdae0c7c..265cffd4c19 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -194,6 +194,28 @@ struct less_second { } }; +// A subset of N3658. More stuff can be added as-needed. + +/// \brief Represents a compile-time sequence of integers. +template struct integer_sequence { + typedef T value_type; + + static LLVM_CONSTEXPR size_t size() { return sizeof...(I); } +}; + +template +struct build_index_impl : build_index_impl {}; +template +struct build_index_impl<0, I...> : integer_sequence {}; + +/// \brief Alias for the common case of a sequence of size_ts. +template +using index_sequence = integer_sequence; + +/// \brief Creates a compile-time integer sequence for a parameter pack. +template +using index_sequence_for = build_index_impl; + //===----------------------------------------------------------------------===// // Extra additions for arrays //===----------------------------------------------------------------------===//