summaryrefslogtreecommitdiff
path: root/kernel/lib/libcxx/include/__tuple/tuple_element.h
diff options
context:
space:
mode:
authorArseney300 <Arseney300@gmail.com>2026-04-12 02:01:25 +0700
committerArseney300 <Arseney300@gmail.com>2026-04-12 02:01:25 +0700
commit2496ffd6d97c3ccd3e325687442d31ab035479a1 (patch)
tree5d176669f823182fe74261f076dc11c8e8f88025 /kernel/lib/libcxx/include/__tuple/tuple_element.h
parent496246c92dabe6757480147016490ea6ae43bb66 (diff)
bastion: add freestanding C++ standard library (libcxx)feature/freestanding-libcxx
Header-only implementation of a C++ standard library subset for the freestanding kernel, using Clang builtins wherever possible. Provides 19 public headers (~35 internal files): type_traits, utility, memory, algorithm, functional, concepts, array, string_view, span, optional, expected, variant, tuple, bit, limits, new, initializer_list, cstdint, cstddef, and source_location. Integration changes: - kernel/Makefile: add -Ilib/libcxx/include to include path - kernel/lib/string.cpp: add memchr and strncmp (needed by string_view) - kernel/lib/cxxabi.cpp: guard placement new against <new> header conflict - kernel/include/kernel/kernel.h: Panic() now uses std::source_location - kernel/core/kernel.cpp: Panic() implementation updated to match Builds cleanly on both x86_64 and aarch64 with zero new warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'kernel/lib/libcxx/include/__tuple/tuple_element.h')
-rw-r--r--kernel/lib/libcxx/include/__tuple/tuple_element.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/lib/libcxx/include/__tuple/tuple_element.h b/kernel/lib/libcxx/include/__tuple/tuple_element.h
new file mode 100644
index 0000000..97b347f
--- /dev/null
+++ b/kernel/lib/libcxx/include/__tuple/tuple_element.h
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the BastionOS freestanding C++ standard library.
+//
+// tuple_size and tuple_element — protocol types for structured bindings.
+// Primary templates here; specializations in pair.h, array, tuple.h, etc.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBBASTION_TUPLE_TUPLE_ELEMENT_H
+#define _LIBBASTION_TUPLE_TUPLE_ELEMENT_H
+
+#include <__config>
+#include <cstddef>
+
+_LIBBASTION_BEGIN_NAMESPACE_STD
+
+// Primary templates (specialized by pair, array, tuple, variant).
+template<class _Tp>
+struct tuple_size; // : integral_constant<size_t, N>
+
+template<class _Tp>
+struct tuple_size<const _Tp> : tuple_size<_Tp> {};
+
+template<class _Tp>
+inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
+
+template<size_t _Ip, class _Tp>
+struct tuple_element; // { using type = ...; }
+
+template<size_t _Ip, class _Tp>
+struct tuple_element<_Ip, const _Tp> {
+ using type = const typename tuple_element<_Ip, _Tp>::type;
+};
+
+template<size_t _Ip, class _Tp>
+using tuple_element_t = typename tuple_element<_Ip, _Tp>::type;
+
+_LIBBASTION_END_NAMESPACE_STD
+
+#endif // _LIBBASTION_TUPLE_TUPLE_ELEMENT_H