diff -r 248fba6d1e76 -r 7fc34735178e sources/list.h --- 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(args...) {} +template +T splice(const T& container, int start, int end, int step = 1) +{ + start = clamp(start, 0, static_cast(container.size())); + end = clamp(end, 0, static_cast(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 +T splice(const T& container, Range& range) +{ + return splice(container, range.min(), range.max(), range.step()); +} + END_ZFC_NAMESPACE