2009-02-09から1日間の記事一覧

template specialization and different return type

C++

ふと、特殊化されたテンプレートごとに戻り値をかえたくなった。ようするにこういうこと。 template<> int foo<short>(); template<> long foo<int>(); ところが、これは一般化されたテンプレートを宣言できないのでうまくいかない。template parameter と戻り値が一緒な</int></short>…