Finding position of a value in an array
mipri
mipri at minimaltype.com
Mon Dec 30 19:39:04 UTC 2019
On Monday, 30 December 2019 at 19:08:27 UTC, Ron Tarrant wrote:
> On Monday, 30 December 2019 at 17:12:26 UTC, MoonlightSentinel
> wrote:
>
>> D disallows implicit conversion from integers to pointers and
>> hence they cannot be compared. You would need to explicitly
>> cast your ulong to an appropriate pointer type
>
> I'm not trying to convert, just wade through an array of
> pointers to find a specific pointer using searchUntil().
>
> I mean, it's not a big deal if I can't do it.
You can definitely do it:
$ rdmd --eval 'int a, b, c; [&a, &b, &c].countUntil(&c).writeln'
2
But you need to have an array of pointers.
More information about the Digitalmars-d-learn
mailing list