llms.txt: machine-readable documentation index. Markdown version of this page is also available.

CLion 2026.3 Help

コード生成

CLion provides multiple ways to generate common code constructs and recurring elements, which helps you increase productivity. これには、新しいファイルの作成時に使用される ファイルテンプレート 、コンテキストに応じて異なる方法で適用されるカスタムまたは定義済みの ライブテンプレート 、各種ラッパー、文字の自動ペアリングなどがあります。

生成 メニューは、コード内に標準的なコード構造をすばやく作成できます。 Depending on the current context, the caret position, or selected code, CLion gives you a list of constructs to be generated.

生成メニュー

生成ポップアップを呼び出す

次のいずれかのオプションを使用します。

  • Alt+Insert を押す。

  • メインメニューから コード | 生成する を呼び出します。

  • エディターを右クリックし、コンテキストメニューから 生成 を選択します。

コンストラクターを生成

  1. 生成 ポップアップから コンストラクター を選択します。

  2. If the class contains fields, select the fields to be initialized:

    コンストラクターを生成
  3. If the インプレースで生成 checkbox is selected, the template constructor will be generated in the public area of the class, otherwise the code will be placed in the corresponding cpp file.

    その場で生成されたコンストラクター

getter および setter を生成

  1. 生成 ポップアップから Getter、 Setter、 Getter と Setter を選択します。

  2. Select the fields to generate the getters/setters for:

    getter および setter を生成
  3. If the インプレースで生成 checkbox is selected, the getters/setters will be generated in the public area of the class, otherwise the code will be placed in the corresponding cpp file.

    Getter および setter はインプレースで生成

等値演算子を生成する

このアクションは、選択されたフィールドを使用して現在のクラスのオブジェクトを比較する operator== および operator!= 関数を生成します。

  1. 生成 ポップアップから 等価演算子 を選択します。

  2. Select the fields to be used and set addition options:

    等値演算子を生成する
  3. If the インプレースで生成 checkbox is selected, the operator functions will be generated in the public area of the class, otherwise the code will be placed in the corresponding cpp file.

    インプレースで生成された等価演算子

関係演算子を生成する

このアクションは、選択したフィールドを使用して現在のクラスのオブジェクトを比較する operator<、 operator>、 operator<=、 operator>= 関数を生成します。

  1. 生成 ポップアップから 比較演算子 を選択します。

  2. Select the fields to be used and set addition options:

    関係演算子を生成する
  3. If the インプレースで生成 checkbox is selected, the operator functions will be generated in the public area of the class, otherwise the code will be placed in the corresponding cpp file.

    インプレースで生成された関係演算子

ストリーム出力演算子を生成する

このアクションは、選択したフィールドを使用して現在のクラスのオブジェクトのストリーム出力を生成する方法を定義する挿入演算子 operator<< を生成します。

  1. 生成 ポップアップから ストリーム出力操作 を選択します。 使用するフィールドを選択します。

  2. If the インプレースで生成 checkbox is selected, the operator function will be generated in the public area of the class, otherwise the code will be placed in the corresponding cpp file.

    インプレースで生成されたストリーム出力演算子
2026 年 11 月 6 日