--- a/sources/list.h Wed Jan 27 12:38:00 2021 +0200 +++ b/sources/list.h Wed Jan 27 13:02:51 2021 +0200 @@ -418,4 +418,24 @@ ByteArray::ByteArray(Args&& ...args) : Vector<unsigned char>(args...) {} +template<typename T> +T splice(const T& container, int start, int end, int step = 1) +{ + start = clamp(start, 0, static_cast<int>(container.size())); + end = clamp(end, 0, static_cast<int>(container.size())); + T result; + result.reserve((end - start) / step); + for (int i = start; i < end; i += step) + { + result.push_back(container[i]); + } + return result; +} + +template<typename T> +T splice(const T& container, Range<int>& range) +{ + return splice(container, range.min(), range.max(), range.step()); +} + END_ZFC_NAMESPACE