mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-28 06:08:05 +03:00
Add 'skip(size_t)' range utility to skip a number of elements
This commit is contained in:
parent
9387abed81
commit
087a940fbe
@ -56,6 +56,24 @@ using IteratorOf = decltype(std::begin(std::declval<Range>()));
|
|||||||
template<typename Range>
|
template<typename Range>
|
||||||
using ValueOf = typename Range::value_type;
|
using ValueOf = typename Range::value_type;
|
||||||
|
|
||||||
|
template<typename Range>
|
||||||
|
struct SkipView
|
||||||
|
{
|
||||||
|
auto begin() const { return std::next(std::begin(m_range), m_skip_count); }
|
||||||
|
auto end() const { return std::end(m_range); }
|
||||||
|
|
||||||
|
Range m_range;
|
||||||
|
size_t m_skip_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto skip(size_t count)
|
||||||
|
{
|
||||||
|
return make_view_factory([count](auto&& range) {
|
||||||
|
using Range = decltype(range);
|
||||||
|
return SkipView<decay_range<Range>>{std::forward<Range>(range), count};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Range, typename Filter>
|
template<typename Range, typename Filter>
|
||||||
struct FilterView
|
struct FilterView
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user