File indexing completed on 2026-05-03 08:13:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___FORMAT_FORMAT_ARGS_H
0011 #define _LIBCPP___FORMAT_FORMAT_ARGS_H
0012
0013 #include <__config>
0014 #include <__cstddef/size_t.h>
0015 #include <__format/format_arg.h>
0016 #include <__format/format_arg_store.h>
0017 #include <__fwd/format.h>
0018 #include <cstdint>
0019
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 # pragma GCC system_header
0022 #endif
0023
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025
0026 #if _LIBCPP_STD_VER >= 20
0027
0028 template <class _Context>
0029 class _LIBCPP_TEMPLATE_VIS basic_format_args {
0030 public:
0031 template <class... _Args>
0032 _LIBCPP_HIDE_FROM_ABI basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept
0033 : __size_(sizeof...(_Args)) {
0034 if constexpr (sizeof...(_Args) != 0) {
0035 if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args))) {
0036 __values_ = __store.__storage.__values_;
0037 __types_ = __store.__storage.__types_;
0038 } else
0039 __args_ = __store.__storage.__args_;
0040 }
0041 }
0042
0043 _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
0044 if (__id >= __size_)
0045 return basic_format_arg<_Context>{};
0046
0047 if (__format::__use_packed_format_arg_store(__size_))
0048 return basic_format_arg<_Context>{__format::__get_packed_type(__types_, __id), __values_[__id]};
0049
0050 return __args_[__id];
0051 }
0052
0053 _LIBCPP_HIDE_FROM_ABI size_t __size() const noexcept { return __size_; }
0054
0055 private:
0056 size_t __size_{0};
0057
0058
0059
0060
0061
0062 union {
0063 struct {
0064 const __basic_format_arg_value<_Context>* __values_;
0065 uint64_t __types_;
0066 };
0067 const basic_format_arg<_Context>* __args_;
0068 };
0069 };
0070
0071 template <class _Context, class... _Args>
0072 basic_format_args(__format_arg_store<_Context, _Args...>) -> basic_format_args<_Context>;
0073
0074 #endif
0075
0076 _LIBCPP_END_NAMESPACE_STD
0077
0078 #endif