boost::range::iota

References

Headers

boost::range::iota is available by including any of the following headers:

  • boost/range/algorithm_ext/iota.hpp or
  • boost/range/algorithm_ext.hpp

Examples

iota.cpp

#include <iostream>
#include <vector>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>

int main() {
    std::vector<int> vec(5, 0);

    // Fill an input range with a linear range of values.
    // The value of the first element is given as second parameter.
    // Returns a reference to the input range.
    boost::range::iota(vec, 10);

    boost::copy(vec, std::ostream_iterator<int>(std::cout, " "));
    std::cout << std::endl;
    return 0;
}

Output:

10 11 12 13 14

 

Boost Range for Humans

This reference is part of Boost Range for Humans. Click the link to the overview.