brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 5955e3e Raw
49 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___CXX03___UTILITY_INTEGER_SEQUENCE_H10#define _LIBCPP___CXX03___UTILITY_INTEGER_SEQUENCE_H11 12#include <__cxx03/__config>13#include <__cxx03/__type_traits/is_integral.h>14#include <__cxx03/cstddef>15 16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17#  pragma GCC system_header18#endif19 20_LIBCPP_BEGIN_NAMESPACE_STD21 22template <size_t...>23struct __tuple_indices;24 25template <class _IdxType, _IdxType... _Values>26struct __integer_sequence {27  template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType>28  using __convert = _ToIndexSeq<_ToIndexType, _Values...>;29 30  template <size_t _Sp>31  using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>;32};33 34#if __has_builtin(__make_integer_seq)35template <size_t _Ep, size_t _Sp>36using __make_indices_imp =37    typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;38#elif __has_builtin(__integer_pack)39template <size_t _Ep, size_t _Sp>40using __make_indices_imp =41    typename __integer_sequence<size_t, __integer_pack(_Ep - _Sp)...>::template __to_tuple_indices<_Sp>;42#else43#  error "No known way to get an integer pack from the compiler"44#endif45 46_LIBCPP_END_NAMESPACE_STD47 48#endif // _LIBCPP___CXX03___UTILITY_INTEGER_SEQUENCE_H49