summaryrefslogtreecommitdiff
path: root/kernel/lib/libcxx/include/__utility/integer_sequence.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lib/libcxx/include/__utility/integer_sequence.h')
-rw-r--r--kernel/lib/libcxx/include/__utility/integer_sequence.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/kernel/lib/libcxx/include/__utility/integer_sequence.h b/kernel/lib/libcxx/include/__utility/integer_sequence.h
new file mode 100644
index 0000000..a18e97d
--- /dev/null
+++ b/kernel/lib/libcxx/include/__utility/integer_sequence.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the BastionOS freestanding C++ standard library.
+//
+// Uses __make_integer_seq builtin for fast compilation.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBBASTION_UTILITY_INTEGER_SEQUENCE_H
+#define _LIBBASTION_UTILITY_INTEGER_SEQUENCE_H
+
+#include <__config>
+#include <cstddef>
+
+_LIBBASTION_BEGIN_NAMESPACE_STD
+
+template<class _Tp, _Tp... _Ip>
+struct integer_sequence {
+ using value_type = _Tp;
+ static constexpr size_t size() noexcept { return sizeof...(_Ip); }
+};
+
+template<size_t... _Ip>
+using index_sequence = integer_sequence<size_t, _Ip...>;
+
+// Use __make_integer_seq builtin for O(log N) instantiation depth.
+template<class _Tp, _Tp _Np>
+using make_integer_sequence = __make_integer_seq<integer_sequence, _Tp, _Np>;
+
+template<size_t _Np>
+using make_index_sequence = make_integer_sequence<size_t, _Np>;
+
+template<class... _Tp>
+using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
+
+_LIBBASTION_END_NAMESPACE_STD
+
+#endif // _LIBBASTION_UTILITY_INTEGER_SEQUENCE_H