range-v3
range-v3 copied to clipboard
Question about spliting a range into subranges by iterator or offset
My question is about split, is there a way to split a range into subranges via iterators or offsets
I uses gsl::span and this helper function currently, but would like to switch to range library for this.
template< typename T >
std::pair< gsl::span< T >, gsl::span< T > > bisect(gsl::span< T > s, typename gsl::span< T >::index_type position)
{
return { s.first(position), s.subspan(position) };
}
I see split is close to what am after, but it only works by delimiter value or predicate far as I can see.
Thanks for the great library.
IIRC, the recommendation is to ask this kind of questions on SO. Maybe https://github.com/ericniebler/range-v3/discussions is also OK.