PrevUpHomeNext

esv::iota


We are also animals.

esv::iota

esv::iota

esv::iota is a function object of class used to generate auto incremental values to a range.

Different with std::iota: esv::iota can take the range name as its parameter, without begin/end.

Different with std::ranges::iota: esv::iota accepts floating point and some more data types, not limited by std::iter_difference_t.

esv::iota: Range Algorithm

esv::iota calling sig

first_type last_itr = esv::iota(first, last, init);
first_type last_itr = esv::iota(range, init);

Header

#include <esvcpp/numeric.hpp>

c++ example

#include <esvcpp/numeric.hpp>
#include <esvcpp/core.hpp>

int main()
{
	std::vector<esv::ix32> v1(11);

	esv::iota(v1, -5);
	esv::print(v1);
// -5 -4 -3 -2 -1 0 1 2 3 4 5

	std::vector<esv::fx32> v2(4);

	esv::iota(v2.begin(), v2.end(), 1.4f);
	esv::print(v2);
// 1.400000 2.400000 3.400000 4.400000
}

See Also

esv::ix32

esv::fx32

esv::print


PrevUpHomeNext

esv::print