#ifndef BOOST_MP11_INTEGER_SEQUENCE_HPP_INCLUDED #define BOOST_MP11_INTEGER_SEQUENCE_HPP_INCLUDED // Copyright 2015, 2017, 2019 Peter Dimov. // // 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 #include #include #if defined(__has_builtin) # if __has_builtin(__make_integer_seq) # define BOOST_MP11_HAS_MAKE_INTEGER_SEQ # endif #endif namespace boost { namespace mp11 { // integer_sequence template struct integer_sequence { }; #if defined(BOOST_MP11_HAS_MAKE_INTEGER_SEQ) template using make_integer_sequence = __make_integer_seq; #else // detail::make_integer_sequence_impl namespace detail { // iseq_if_c template struct iseq_if_c_impl; template struct iseq_if_c_impl { using type = T; }; template struct iseq_if_c_impl { using type = E; }; template using iseq_if_c = typename iseq_if_c_impl::type; // iseq_identity template struct iseq_identity { using type = T; }; template struct append_integer_sequence; template struct append_integer_sequence, integer_sequence> { using type = integer_sequence< T, I..., ( J + sizeof...(I) )... >; }; template struct make_integer_sequence_impl; template struct make_integer_sequence_impl_ { private: static_assert( N >= 0, "make_integer_sequence: N must not be negative" ); static T const M = N / 2; static T const R = N % 2; using S1 = typename make_integer_sequence_impl::type; using S2 = typename append_integer_sequence::type; using S3 = typename make_integer_sequence_impl::type; using S4 = typename append_integer_sequence::type; public: using type = S4; }; template struct make_integer_sequence_impl: iseq_if_c>, iseq_if_c>, make_integer_sequence_impl_ > > { }; } // namespace detail // make_integer_sequence template using make_integer_sequence = typename detail::make_integer_sequence_impl::type; #endif // defined(BOOST_MP11_HAS_MAKE_INTEGER_SEQ) // index_sequence template using index_sequence = integer_sequence; // make_index_sequence template using make_index_sequence = make_integer_sequence; // index_sequence_for template using index_sequence_for = make_integer_sequence; } // namespace mp11 } // namespace boost #endif // #ifndef BOOST_MP11_INTEGER_SEQUENCE_HPP_INCLUDED