Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.07 KB

class_template_argument_deduction_for_aggregates.md

File metadata and controls

28 lines (20 loc) · 1.07 KB

集成体クラステンプレートのテンプレート引数推論

  • cpp20[meta cpp]

概要

C++17で導入されたクラステンプレートのテンプレート引数推論は、コンストラクタ引数からテンプレート引数を推論するものであった。

C++20では、ユーザー定義のコンストラクタをもたない集成体クラステンプレートの初期化からクラステンプレート引数を推論できるようにする。

template <class T>
struct Point {
  T x;
  T y;
};

Point p1{3.0, 4.0}; // C++17:NG C++20:OK

関連項目

参照