Void pointers
Alex via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 17 08:33:09 PDT 2016
On Tuesday, 17 May 2016 at 13:25:34 UTC, ag0aep6g wrote:
> On 05/17/2016 03:14 PM, Alex wrote:
>> For a slice I surely need two numbers. But this should all be,
>> what I
>> need for a slice. For a iota, I need a maximum, which is not
>> provided
>> (at least at this moment) to the object containing the
>> pointer/iota thing.
>
> The slice's length is practically the same as iota's maximum.
> For slicing a pointer you need the minimum and the maximum,
> just as with iota. I don't see the difference.
>
> ptr[5 .. 10] vs iota(5, 10) - Surely you need the number 10 in
> both cases?
Ok cool, maybe I oversee something myself. But let think in an
example:
There are some objects which make slices. How they make a slice
is unimportant here, so it makes either ptr[5 .. 10] or iota(5,
10).
But, if the slicing is made by means of iota, there is no (at
least no explicit) dependence between the slices, which could be
made by different objects.
I'm ready to admit, that the process will work with independent
slicing... In this case, I can omit my void* at all. So, the
objects, which make slices, don't do this from some object, they
do this just by calling iota. But this is little bit contra
intuitive, as I imply a relationship between the sliced parts.
So... at the end of the day this implication exists in my head
only...
More information about the Digitalmars-d-learn
mailing list