#include <iostream> #include <boost/range/algorithm/for_each.hpp> #include <boost/any.hpp> #include <vector> void disp( int n ) { std::cout << n << "," ; } int main(void) { std::vector<int> v; for( int i = 0; i < 5; ++i ) v.push_back( i ); boost::any a = v; const std::vector<int>& vr = boost::any_cast< std::vector<int> >( a ); boost::for_each( vr, disp ); return 0; }
0 件のコメント:
コメントを投稿