// Copyright (c) 2018 Sergei Fedorov // Copyright (c) 2019-2021 Antony Polukhin // // 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) #ifndef BOOST_PFR_DETAIL_MAKE_INTEGER_SEQUENCE_HPP #define BOOST_PFR_DETAIL_MAKE_INTEGER_SEQUENCE_HPP #pragma once #include #include #include #include namespace boost { namespace pfr { namespace detail { #if BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE == 0 #ifdef __has_builtin # if __has_builtin(__make_integer_seq) # define BOOST_PFR_USE_MAKE_INTEGER_SEQ_BUILTIN # endif #endif #ifdef BOOST_PFR_USE_MAKE_INTEGER_SEQ_BUILTIN using std::integer_sequence; // Clang unable to use namespace qualified std::integer_sequence in __make_integer_seq. template using make_integer_sequence = __make_integer_seq; #undef BOOST_PFR_USE_MAKE_INTEGER_SEQ_BUILTIN #else template struct join_sequences; template struct join_sequences, std::integer_sequence> { using type = std::integer_sequence; }; template struct build_sequence_impl { static_assert(Min < Max, "Start of range must be less than its end"); static constexpr T size = Max - Min; using type = typename join_sequences< typename build_sequence_impl::type, typename build_sequence_impl::type >::type; }; template struct build_sequence_impl { using type = std::integer_sequence; }; template struct make_integer_sequence_impl : build_sequence_impl {}; template struct make_integer_sequence_impl { using type = std::integer_sequence; }; template using make_integer_sequence = typename make_integer_sequence_impl::type; #endif // !defined BOOST_PFR_USE_MAKE_INTEGER_SEQ_BUILTIN #else // BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE == 1 template using make_integer_sequence = std::make_integer_sequence; #endif // BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE == 1 template using make_index_sequence = make_integer_sequence; template using index_sequence_for = make_index_sequence; }}} // namespace boost::pfr::detail #endif