std::basic_format_args(3)

๐Ÿ“ฆ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

๐ŸŒธ NAME ๐ŸŒธ

Bestie, this is std::basic_format_args โ€” the manual page is std::basic_format_args(3), from the C++ Standard Library (the header says C++ Standard Libary, and honestly? iconic typo). The NAME line is literally std::basic_format_args - std::basic_format_args, so it said what it said. ๐Ÿ’…


โœจ Synopsis โœจ

Defined in header <format>.

template< class Context >                                     (1)
(since C++20)
class basic_format_args;
using format_args = basic_format_args<std::format_context>;   (2)
(since C++20)
using wformat_args = basic_format_args<std::wformat_context>; (3)
(since C++20)

Provides access to formatting arguments. periodt. ๐ŸŒˆ


๐Ÿ’… Member functions ๐Ÿ’…

  • constructor โ€” constructs a basic_format_args object (public member function)
  • get โ€” returns formatting argument at the given index (public member function)

๐Ÿ’– std::basic_format_args::basic_format_args ๐Ÿ’–

basic_format_args() noexcept;

(1)

template< class... Args >
basic_format_args( const /*format-arg-store*/<Context, Args...>& store ) noexcept;

(2)

  1. Overload (1) โ€” constructs a basic_format_args object that does not hold any formatting argument.
  2. Overload (2) โ€” constructs a basic_format_args object from the result of a call to std::make_format_args or std::make_wformat_args.
๐Ÿšจ std::basic_format_args has reference semantics. It is the programmer's responsibility to ensure that *this does not outlive store (which, in turn, should not outlive the arguments to std::make_format_args or std::make_wformat_args). No cap.

๐ŸŽฏ std::basic_format_args::get ๐ŸŽฏ

std::basic_format_arg<Context> get( std::size_t i ) const noexcept;

Returns a std::basic_format_arg holding the i-th argument in args, where args is the parameter pack passed to std::make_format_args or std::make_wformat_args.

If there's no such formatting argument (i.e. *this was default-constructed or i is not less than the number of formatting arguments), returns a default-constructed std::basic_format_arg (holding a std::monostate object). Vibe check: handled. ๐Ÿ’œ

๐Ÿ”ฎ Deduction guides ๐Ÿ”ฎ

template< class Context, class... Args >
basic_format_args( /*format-arg-store*/<Context, Args...> ) -> basic_format_args<Context>;

(since C++20)


๐ŸŽ€ Example ๐ŸŽ€

This section is incomplete, bestie. The reason is literally: Reason: no example. That's it. That's the whole section. ๐Ÿ˜ญ


๐Ÿ’€ Defect reports ๐Ÿ’€

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

  • P2216R3
    • Applied to: C++20
    • Behavior as published: format_args_t was provided due to overparameterization of vformat_to
    • Correct behavior: removed
  • LWG3810
    • Applied to: C++20
    • Behavior as published: basic_format_args has no deduction guide
    • Correct behavior: added

๐Ÿฆ‹ See also ๐Ÿฆ‹

  • basic_format_arg (C++20) โ€” class template that provides access to a formatting argument for user-defined formatters (class template)

๐Ÿ“ Category ๐Ÿ“

  • Todo no example

๐Ÿ’– that's the whole page, bestie โ€” source: http://cppreference.com, dated 2024.06.10, page std::basic_format_args(3). go off, C++ formatting icon โœจ๐Ÿ’…

๐Ÿ“ฆ where this page comes from