contains method on immutable sorted array

Andrey saasecondbox at yandex.ru
Mon Oct 21 10:14:54 UTC 2019


Hello,
I have got a global constant immutable array:
> immutable globalvalues = sort(cast(wstring[])["й", "ц", "ук", 
> "н"]);

Somewhere in program I want to check an existance:
> globalvalues.contains("ук"w).writeln;

But get an error:
> Error: template std.range.SortedRange!(wstring[], "a < 
> b").SortedRange.contains cannot deduce function from argument 
> types !()(wstring) immutable, candidates are:
> /dlang/ldc-1.17.0/bin/../import/std/range/package.d(10993):
> std.range.SortedRange!(wstring[], "a < 
> b").SortedRange.contains(V)(V value) if 
> (isRandomAccessRange!Range)

Why I can't check?


More information about the Digitalmars-d-learn mailing list