2010-03-18から1日間の記事一覧

テンプレート・テンプレート・パラメータ

C++テンプレートテクニック 2-8 template<class T> class CClass { T<int> m_x; }; $ cl /W4 /EHsc main.cpp Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. main.cpp main.</int></class>…

template限定子

C++テンプレートテクニック 2-6 template<class T> int foo(T x,int n) { return x.get<3>(n); } 上記のようなテンプレートの場合、「x.get(n)」は変数xのgetメンバ関数の呼び出しを期待しているわけなのだが、変数xのgetメンバ変数と3を比較するという処理、つまり「</class>…