Finding position of a value in an array

Ali Çehreli acehreli at yahoo.com
Sat Feb 6 22:32:53 UTC 2021


On 2/6/21 2:26 PM, mw wrote:
> 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.
> 

I bet it returns size_t.max in that case.

Ali



More information about the Digitalmars-d-learn mailing list