Finding position of a value in an array

mw mingwu at gmail.com
Sat Feb 6 22:26:37 UTC 2021


On Tuesday, 31 December 2019 at 14:52:55 UTC, Steven 
Schveighoffer wrote:
> On 12/31/19 9:47 AM, Steven Schveighoffer wrote:
>
>> for the original example:
>> 
>>      int[] a = [77,66,55,44];
>>      int i = a.bwin.find(55).bufRef.pos;
>
> sorry, should be size_t i.
>


Unsigned?

Then how the function signal no such element found?

The convention of indexOf is to use -1.



More information about the Digitalmars-d-learn mailing list