Use __make_integer_seq builtin for std::make_integer_sequence. Patch by K-ballo.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@255162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2015-12-09 22:03:06 +00:00
parent 5be047d322
commit 76d2446cf4
6 changed files with 68 additions and 12 deletions

View File

@@ -680,6 +680,16 @@ struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
template<size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
struct __make_integer_sequence
{
typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
};
#else
namespace __detail {
template<typename _Tp, size_t ..._Extra> struct __repeat;
@@ -733,10 +743,12 @@ struct __make_integer_sequence
{
static_assert(is_integral<_Tp>::value,
"std::make_integer_sequence can only be instantiated with an integral type" );
static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
};
#endif
template<class _Tp, _Tp _Np>
using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;