
Peng Yu <pengyu.ut <at> gmail.com> writes:
The following program uses virtual functions. Essentially I need to go
[skip]
}
Am I correctly understand that you are looking for something link this: =================================================== #include <iostream> #include <boost/fusion/algorithm.hpp> #include <boost/fusion/container.hpp> struct square { void show_me() const { std::cout << "square"; } }; struct circle { void show_me() const { std::cout << "circle"; } }; struct triangle { void show_me() const { std::cout << "triangle"; } }; template<class T, class End> void out_pair(const T &, const End &, const End &) {} template<class T, class Begin, class End> void out_pair(const T & t, const Begin & begin, const End & end) { t.show_me(); std::cout << " vs. "; deref(begin).show_me(); std::cout << std::endl; out_pair(t, next(begin), end); } template<class End> void out(const End &, const End &) {} template<class Begin, class End> void out(const Begin & begin, const End & end) { out_pair(deref(begin), next(begin), end); out(next(begin), end); } int main() { typedef boost::fusion::vector<square, circle, square, triangle> Vec; Vec v; out(begin(v), end(v)); } =================================================== Best Regards, Sergei