問:int型の配列(コンパイル時に長さがわかるもの) b を
std::vector v1, v2, v3にそれぞれコピーして表示せよ。


#include
#include
#include
#include
#include
#include

int main()
{
using namespace std;
using namespace pstade::oven;
vector v1, v2, v3;
int b[] = {1,3,4,5,3,2,5,1,2};

copy( b|begin, b|end,
copier(back_inserter(v1)) |= copier(back_inserter(v2)) |= back_inserter(v3) );

cout << "--v1--" << endl;
BOOST_FOREACH(const int i, v1) { cout << i << endl; }
cout << "--v2--" << endl;
BOOST_FOREACH(const int i, v2) { cout << i << endl; }
cout << "--v3--" << endl;
BOOST_FOREACH(const int i, v3) { cout << i << endl; }

return 0;
}

素敵だな〜。
実質的なcopy処理はcopy(...)の行だけなんだぜ!

ライブラリ側のソースコード解説ができるようになればもっと有意義なんだけども。。。