2007-11-05から1日間の記事一覧

C++0x - Default template arguments for function templates

C++

関数テンプレートの、デフォルトテンプレート引数が使えるようになる template <class T, class U = double> void f(T t = 0, U u = 0); void g() { f(1, 'c'); // f<int,char>(1,'c') f(1) // f<int,double>(1,0) f(); // error: T cannot be deduced f<int>(); // f<int,double>(0,0) f<int,char>(); // f<int,char>(0,0) } DR226 Default template</int,char></int,char></int,double></int></int,double></int,char></class>…