• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    class template
    <format>

    std::basic_format_arg

    namespace std {
      template<class Context>
      class basic_format_arg {
      public:
        class handle;
    
      private:
        using char_type = typename Context::char_type;                              // exposition only
    
        variant<monostate, bool, char_type,
                int, unsigned int, long long int, unsigned long long int,
                float, double, long double,
                const char_type*, basic_string_view<char_type>,
                const void*, handle> value;                                         // exposition only
    
        template<class T> explicit basic_format_arg(T& v) noexcept;                 // exposition only
    
      public:
        basic_format_arg() noexcept;
    
        explicit operator bool() const noexcept;
    
        template<class Visitor>
          decltype(auto) visit(this basic_format_arg arg, Visitor&& vis);
        template<class R, class Visitor>
          R visit(this basic_format_arg arg, Visitor&& vis);
      };
    }
    

    概要

    フォーマット引数1つを保持する型。

    デフォルトコンストラクタのみ公開されていて、デフォルトコンストラクタで構築したオブジェクトは無効である。 この型の有効なオブジェクトを直接構築することはできず、make_format_argsを使う必要がある。

    保持している値へのアクセスはvisit_format_argを使う。

    このテンプレートを特殊化した場合、プログラムの動作は未定義である。

    メンバ関数

    構築・破棄

    名前 説明 対応バージョン
    (constructor) コンストラクタ C++20

    変換演算子

    名前 説明 対応バージョン
    operator bool boolへの変換演算子(空の時false) C++20

    メンバ型

    名前 説明 対応バージョン
    handle ユーザー定義型のアドレスを保持する型 (class) C++20

    非メンバ関数

    名前 説明 対応バージョン
    make_format_args basic_format_argの列を構築する (function template) C++20
    visit_format_arg basic_format_argオブジェクトが現在保持している型に対応する関数を呼び出す (function template) C++20

    バージョン

    言語

    • C++20

    処理系

    参照