mirror of
https://github.com/boostorg/mp11.git
synced 2025-08-06 07:44:31 +02:00
Use __make_integer_seq when available
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#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.
|
||||
//
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
#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...>;
|
||||
|
||||
|
Reference in New Issue
Block a user