Trying to use a template class with ranges
    mark 
    mark at qtrac.eu
       
    Thu Feb  6 17:06:36 UTC 2020
    
    
  
On Thursday, 6 February 2020 at 16:29:57 UTC, Steven 
Schveighoffer wrote:
> On 2/6/20 11:05 AM, mark wrote:
>> src/package.d(50,35): Error: no property opCall for type 
>> diffrange.Diff!(dchar[]), did you mean new Diff!(dchar[])?
>
> Hah, forgot that it's a class. Yes, I DID mean new Diff ;)
>
> -Steve
Wow, that's all it needed to compile!
And I've added the extra check you suggested:
auto differ(T)(T a, T b) if (
         isForwardRange!T && // T is a range
         is(typeof(T.init.front == T.init.front)) // Elements 
support ==
         ) {
     return new Diff!T(a, b);
}
Thanks!
    
    
More information about the Digitalmars-d-learn
mailing list