2010-03-08から1日間の記事一覧
「戻り値の型が異なる関数をオーバーロードしたい!」 ってことがよくある。 とりあえずパッと思いついたのはこれ。 ※Traits(=特性)というテクニックらしい 追記:2010-03-14 template<class T> T getValue(); template<> int getValue<int>() { return 1; } template<> cha</int></class>…
「戻り値の型が異なる関数をオーバーロードしたい!」 ってことがよくある。 とりあえずパッと思いついたのはこれ。 ※Traits(=特性)というテクニックらしい 追記:2010-03-14 template<class T> T getValue(); template<> int getValue<int>() { return 1; } template<> cha</int></class>…