free func "front" is not picked up as a candidate when doing range.front(...)
Paul Backus
snarwin at gmail.com
Wed Feb 7 20:08:10 UTC 2018
On Wednesday, 7 February 2018 at 19:25:01 UTC, aliak wrote:
> import std.range: iota;
> 0.iota.front(100).writeln;
> // Error: inout method std.range.iota!(int,
> int).iota.Result.front is not callable using a mutable object
>
> import std.algorithm: filter;
> auto arr = [0, 1];
> arr.filter!"true".front(99).writeln;
> // Error: function
> std.algorithm.iteration.FilterResult!(unaryFun,
> int[]).FilterResult.front () is not callable using argument
> types (int)
>
You can only call a function with UFCS syntax if the object
you're calling it with does not have a member with the same name
as the function. Both iota's `Result` type and `FilterResult`
have properties named "front", so you can't call your front
function on them using UFCS syntax.
More information about the Digitalmars-d-learn
mailing list