Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_format_args

      From cppreference.com
      <cpp‎ |utility‎ |format
       
       
       
      Formatting library
      Standard format specification
      Formatting functions
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      Format strings
      Formatting concepts
      Formatter
      (C++20)
      Formatting arguments
      basic_format_argsformat_argswformat_args
      (C++20)(C++20)(C++20)
      (C++20)(deprecated in C++26)
      Format error
       
      Defined in header<format>
      template<class Context>
      class basic_format_args;
      (1)(since C++20)
      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.

      Contents

      [edit]Member functions

      (constructor)
      constructs abasic_format_args object
      (public member function)
      get
      returns formatting argument at the given index
      (public member function)

      std::basic_format_args::basic_format_args

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

      Constructs abasic_format_args object from the result of a call tostd::make_format_args orstd::make_wformat_args.

      std::basic_format_args::get

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

      Returns astd::basic_format_arg holding thei-th argument inargs, whereargs is the parameter pack passed tostd::make_format_args orstd::make_wformat_args.

      If there's no such formatting argument (i.e.*this was default-constructed ori is not less than the number of formatting arguments), returns a default-constructedstd::basic_format_arg (holding astd::monostate object).

      [edit]Deduction guides

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

      [edit]Notes

      std::basic_format_args has reference semantics. It is the programmer's responsibility to ensure that*this does not outlivestore (which, in turn, should not outlive the arguments tostd::make_format_args orstd::make_wformat_args).

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]Defect reports

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

      DRApplied toBehavior as publishedCorrect behavior
      P2216R3C++20format_args_t was provided due to overparameterization ofvformat_toremoved
      LWG 3810C++20basic_format_args has no deduction guideadded
      LWG 4106C++20basic_format_args was default-constructibledefault constructor removed

      [edit]See also

      class template that provides access to a formatting argument for user-defined formatters
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/format/basic_format_args&oldid=173189"

      [8]ページ先頭

      ©2009-2025 Movatter.jp