PrevUpHomeNext

utx::iota


utx::iota

utx::iota

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

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

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

utx::iota: Range Algorithm

utx::iota calling sig

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

Header

#include <utxcpp/numeric.hpp>

c++ example

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

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

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

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

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

See Also

utx::ix32

utx::fx32

utx::print

cpp/c++

c++ std::exception:

std::cout.write(err.data(), err.size());

std::cout << std::endl;

caught:

  ==================================================
  #        The c++ programming language.           #
  #                                                #
  #        Home: cppfx.xyz                         #
  #        E                                       #
  #        Deck                                    #
  ==================================================

PrevUpHomeNext