yohhoyの日記

技術的メモをしていきたい日記

iotaアルゴリズム

C++11標準ライブラリに新しく追加されたアルゴリズムstd::iotaについてメモ。

#include <algorithm>

int a[5];
std::iota(a, a+5, 1);  // a == {1,2,3,4,5}
#include <boost/range/algorithm_ext/iota.hpp>

int a[5];
boost::iota(a, 1);  // a == {1,2,3,4,5}

関連URL