genetically modified slices - is it possible?

Alexandr Druzhinin drug2004 at bk.ru
Sat Nov 16 04:30:43 PST 2013


16.11.2013 18:38, Jonathan M Davis пишет:
>
> Well, if you want to get a slice which refers to the same thing as that slice
> but includes elements which are in what is being sliced but which aren't in
> that slice, you can only get the slice that you want be reslicing whatever the
> slices came from. So, that means that you have to have a range which refers to
> all of the elements that you want your target range to refer to and possibly
> more and then either slice that range to exactly the elements that you want or
> pop off elements until you get the range that you want. Doing that generally
> requires knowing how many elements to pop off or the indices to slice, which
> basically means that you have to keep track of indices.
>
> In general, it doesn't work very well to increase a range so that it covers
> more elements. They're designed to be reduced, not increased, and so the more
> "D" way of doing things with ranges essentially goes against what you're
> trying to do, forcing you to come at the problem from a different angle. And in
> this case, it sounds like that probably means keeping track of indices.
>
> - Jonathan M Davis
>
Thanks for reply. It shows that there are different tools for different 
jobs and I should use appropriate tool for specific job.


More information about the Digitalmars-d-learn mailing list