simple question about UFCS and templates...wasFound(i) works but not i.wasFound()
WhatMeWorry
kheaser at gmail.com
Wed Mar 19 22:26:54 UTC 2025
```
bool wasFound(I)(I result)
{
return(result != -1);
}
bool existPoint(Point b, int cost)
{
auto i = closed.countUntil(b);
if(wasFound(i)) // -1 is returned if no point b is
found in the range
```
The above compiles and executes successfully. But the following
fails with:
app.d(179,13): Error: no property `wasFound` for `i` of type
`long`
I thought the templated function would take care of any type.
```
bool wasFound(I)(I result)
{
return(result != -1);
}
bool existPoint(Point b, int cost)
{
auto i = closed.countUntil(b); // Note: closed
if(i.wasFound()) // -1 is returned if no point b is
found in the range
```
More information about the Digitalmars-d-learn
mailing list