MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / numbers_step

Function numbers_step

include/fplus/container_common.hpp:1964–1976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1962template <typename T,
1963 typename ContainerOut = std::vector<T>>
1964ContainerOut numbers_step(const T start, const T end, const T step)
1965{
1966 ContainerOut result;
1967 if ((step > 0 && start >= end) || (step < 0 && start <= end) || step == 0) {
1968 return result;
1969 }
1970 std::size_t size = static_cast<std::size_t>((end - start) / step);
1971 internal::prepare_container(result, size);
1972 auto it = internal::get_back_inserter(result);
1973 for (T x = start; x < end; x += step)
1974 *it = x;
1975 return result;
1976}
1977
1978// API search type: numbers : (a, a) -> [a]
1979// fwd bind count: 1

Callers 1

problem_16Function · 0.50

Calls 2

prepare_containerFunction · 0.70
get_back_inserterFunction · 0.70

Tested by

no test coverage detected