久々に。。
かなり長いことC++を触ってませんでした・・・。
時間見つけて復習していこう。。
template< int V > class Int2Type { public : enum { Value = V }; }; template< int V > class Hoge { private : void Foo( Int2Type<0> ) { cout << "Zero !!" << endl; } void Foo( Int2Type<1> ) { cout << "One !!" << endl; } void Foo( Int2Type<2> ) { cout << "Two !!" << endl; } public : void Foo() { Foo( Int2Type<V>() ); } }; int main( void ) { Hoge<1> h; h.Foo(); }
なんかアラスカの教育機関からこの日記にアクセスがありました。
「オゥ,ニッポンノー,スットコドッコイハー,ダレデスカー」ってな感じでぐぐったに違いない。