C++と色々

主にC++やプログラムに関する記事を投稿します。

2015-02-16から1日間の記事一覧

boost::fusion::vectorで異なる型のコンテナ

動的な多態性を持った型のオブジェクトをコンテナで扱いたい場合、基本クラスの参照型または基本クラスのポインタ型のコンテナを使うことができます: #include <iostream> #include <memory> #include <vector> struct A { void disp() const { do_disp(); } private: virtual void do_</vector></memory></iostream>…