std::vector<range> split_range(const range r, const size_t num_splits) {
    uint_t sub_range_length = r.length() / num_splits;

    std::vector<range> splits;

    uint_t curr_start = r.start;
    for (size_t i = 0; i + 1 < num_splits; ++i) {
        splits.push_back(range(curr_start, curr_start + sub_range_length - 1));
        curr_start += sub_range_length;
    }
    splits.push_back(range(curr_start, r.end));
    return splits;
}
Exemplo n.º 2
0
		inline range<entity<Segments ... >> take_last(range<entity<Segments ... >> const & object, type::index_t const count) noexcept
		{
			return { object.back() - ((count % (object.length() + 1)) - 1), count % (object.length() + 1) };
		}
Exemplo n.º 3
0
		inline range<entity<Segments ... >> take_first(range<entity<Segments ... >> const & object, type::index_t const count) noexcept
		{
			return { object.offset(), count % (object.length() + 1) };
		}