2012-10-24から1日間の記事一覧

全ての型を継承する型を定義

Boost.MPL の inherit を使用すれば、テンプレート引数型を全て継承する型を定義することが出来ます。 [ソース] #include <boost/mpl/inherit.hpp> #include <iostream> #include <type_traits> struct X1{ int value; }; struct X2{ void func() const{ std::cout << "X2" << std::endl; } }; int main(){ </type_traits></iostream></boost/mpl/inherit.hpp>…