stepsは、イテレータをn個ずつ進めるようにするためのRangeアダプタです。
以下の場合は、{0, 1, 2, 3...99}の範囲をstepsを使用して10ずつ進めています。
#include <iostream> #include <pstade/oven/counting.hpp> #include <pstade/oven/steps.hpp> #include <pstade/oven/io.hpp> using namespace pstade::oven; int main() { std::cout << (counting(0, 100)|steps(10)) << std::endl; }
{0,10,20,30,40,50,60,70,90}
stepsを重ね掛けすることもできます。
以下の場合は、{0,1,2,3...99}の範囲を10x4ずつ進めています。
#include <iostream> #include <pstade/oven/counting.hpp> #include <pstade/oven/steps.hpp> #include <pstade/oven/io.hpp> using namespace pstade::oven; int main() { std::cout << (counting(0, 100)|steps(10)|steps(4)) << std::endl; }
{0,40,80}
【参照】
pstade::oven::steps