Use __make_integer_seq when available

This commit is contained in:
Peter Dimov
2019-01-15 20:22:39 +02:00
parent 8e60b42fa0
commit c51289bcb5

View File

@@ -1,15 +1,21 @@
#ifndef BOOST_MP11_INTEGER_SEQUENCE_HPP_INCLUDED
#define BOOST_MP11_INTEGER_SEQUENCE_HPP_INCLUDED
// Copyright 2015, 2017 Peter Dimov.
// Copyright 2015, 2017, 2019 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <cstddef>
#if defined(__has_builtin)
# if __has_builtin(__make_integer_seq)
# define BOOST_MP11_HAS_MAKE_INTEGER_SEQ
# endif
#endif
namespace boost
{
namespace mp11
@@ -20,6 +26,12 @@ template<class T, T... I> struct integer_sequence
{
};
#if defined(BOOST_MP11_HAS_MAKE_INTEGER_SEQ)
template<class T, T N> using make_integer_sequence = __make_integer_seq<integer_sequence, T, N>;
#else
// detail::make_integer_sequence_impl
namespace detail
{
@@ -82,6 +94,8 @@ template<class T, T N> struct make_integer_sequence_impl: iseq_if_c<N == 0, iseq
// make_integer_sequence
template<class T, T N> using make_integer_sequence = typename detail::make_integer_sequence_impl<T, N>::type;
#endif // defined(BOOST_MP11_HAS_MAKE_INTEGER_SEQ)
// index_sequence
template<std::size_t... I> using index_sequence = integer_sequence<std::size_t, I...>;